如何应用angularjs(ng-show)的变化?

sl_*_*bug 6 angularjs

我有表格

<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>
Run Code Online (Sandbox Code Playgroud)

控制器:

utApp.controller('SessionController', ($scope, $cookieStore, ClientService) ->
  $scope.login = ->
    ...
    if something
      $scope.invalid_credentials = true
      return
Run Code Online (Sandbox Code Playgroud)

在某些条件下$scope.invalid_credentials设置为true,但没有显示带错误消息的div.怎么展示它?

Sim*_*nst 9

Angular不会重新检查invalid_credentials变量的值.使用函数作为ng-show参数应该有效.