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: enter image description here

and here i'm checking $location , $$url "/dashboard" if statement should skipped, yet continues? enter image description here

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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -