AngularJS
我有一个基于条件应用类的场景,在该条件下我动态地将值存储在 rootscope 中并在 html 角度表达式中进行评估,但仍然无法正常工作
<li role="presentation" style="width:200px" ng-class="{active: true, inactive: false}[{{vm.$rootScope.currentPage}}==1]"><a href="#/create">Create</a></li>
在检查元素中,如果我检查我可以看到 1==1 但仍然类没有激活,如果我删除 {{vm.$rootScope.currentPage}} 并放置 1 它正在工作
我也试过这个
<li role="presentation" style="width:200px" ng-class="{'active':2=={{vm.$rootScope.currentPage}} }"><a href="#/include">include</a></li>
同样的事情我也可以看到 2==2 但仍然没有激活,如果 Istatically 放置 2==2 它正在工作