how to compare a stringvalue in ng-show inside a customdirective?

瘦欲@ 提交于 2019-11-30 17:09:44

The expression

ng-show="name.status_p1==working"

compares name.status_p1 with a working property on the current scope, which is not defined in your case. What you need is to compare it with the literal string 'working'.

ng-show="name.status_p1=='working'";

Modified Plunkr

In my case, I had this:

ng-show ="authenticated == {{it.logged_in_view}} || {{it.logged_in_view == 'neutral'}}"

and had to change it to this:

ng-show ='authenticated == {{it.logged_in_view}} || {{it.logged_in_view == "neutral"}}'

I enclosed the attribute string in single quotes and the string to be compared in double quotes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!