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

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -