javascript - Why did this if check pass? -
i'm checking if $location.$$url
!= 'dashboard'
statement true, yet continues.
// url @ /dashboard if ($location.$$url !== "/dashboard") console.log('custome url found!'); vs.customurl = true; tagfactory.buildurlobject($location.$$url);
you can see console.log
print out /dashboard
below:
and here i'm checking $location
, $$url
"/dashboard"
if
statement should skipped, yet continues?
as comments state, missing curly braces.
try changing following statements contained within condition.
if ($location.$$url !== "/dashboard") { console.log('custome url found!'); vs.customurl = true; tagfactory.buildurlobject($location.$$url); }
without curly braces if statement single statement. example do:
if ($location.$$url !== "/dashboard") alert("not dashboard");
or
if ($location.$$url !== "/dashboard"){ alert("not dashboard"); //additional statements here }
Comments
Post a Comment