我有表格
<form ng-controller="SessionController" name="login_form"> <div class="hide" ng-show='invalid_credentials'>Invalid email/pass</div> <input type="submit" value="Login" ng-click='login()'> </form>
控制器:
utApp.controller('SessionController',($scope,$cookieStore,ClientService) -> $scope.login = -> ... if something $scope.invalid_credentials = true return
在某些情况下,$scope.invalid_credentials设置为true,但没有显示带错误消息的div.怎么展示它?
Angular不会重新检查invalid_credentials变量的值.使用函数作为ng-show参数应该有效.
原文链接:https://www.f2er.com/angularjs/140328.html