How do I negate the parameter for AngularJS ng-if directive?

前端 未结 2 1522
遥遥无期
遥遥无期 2021-01-04 02:41

Quick Example:

There is a routed parameter (/Home/:isLoggedIn) that equates to true or false. (/Demo/#/Home/false) and a controller property

this.logged

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-04 03:27

    Problem is likely home.loggedIn is a string, when passed to ng-if it is probably evaluating and doing the conversion from string to bool to get the value "false" into false. In the expression evaluation before the value is passed through if you have !"false" that is actually false since any string is true, negating it becomes false.

提交回复
热议问题