Javascript 如果工作不正常,是否会出现异常?
当我调用Javascript 如果工作不正常,是否会出现异常?,javascript,angularjs,Javascript,Angularjs,当我调用console.log($scope.showAddEvent)时,它显示showAddEvent正在更改,但ng if似乎没有反映这些更改。它根本没有显示出来 我对angularjs还很陌生,所以我不确定我做错了什么 html <ion-footer-bar align-title="center" class="bar-positive" ng-if="$scope.showAddEvent == true"> <div class="title"
console.log($scope.showAddEvent)
时,它显示showAddEvent
正在更改,但ng if似乎没有反映这些更改。它根本没有显示出来
我对angularjs还很陌生,所以我不确定我做错了什么
html
<ion-footer-bar align-title="center" class="bar-positive" ng-if="$scope.showAddEvent == true">
<div class="title" ng-click="modal.show()">Add Event</div>
</ion-footer-bar>
在模板中,不应引用范围。改变
<ion-footer-bar align-title="center" class="bar-positive" ng-if="$scope.showAddEvent == true">
到
在模板中,不应引用范围。改变
<ion-footer-bar align-title="center" class="bar-positive" ng-if="$scope.showAddEvent == true">
到
在html模板中不需要$scope
它应该是ng if=“showAddEvent”
在html模板中不需要$scope
它应该是ng if=“showAddEvent”
作为一个小的更新,你可以做ng if=“showAddEvent”
如果$scope.showAddEvent
总是属于布尔类型。在我看来,这只会让事情稍微整洁一点。每次我看到一个与布尔值相等的比较,我都会有点畏缩literal@DustinHodges我知道你的意思,但这取决于上下文。有时候我想说清楚,JS有时是多么模棱两可。。。Taylor事先警告过你,你会遇到很多像这样的小事情。祝你好运作为一个小更新,您可以执行ng if=“showAddEvent”
if$scope。showAddEvent
总是属于布尔类型。在我看来,这只会让事情稍微整洁一点。每次我看到一个与布尔值相等的比较,我都会有点畏缩literal@DustinHodges我知道你的意思,但这取决于上下文。有时候我想说清楚,JS有时是多么模棱两可。。。Taylor事先警告过你,你会遇到很多像这样的小事情。祝你好运
<ion-footer-bar align-title="center" class="bar-positive" ng-if="showAddEvent">