AngularJS - ng-disabled禁用Firefox中的其他字段



下面的代码不起作用:

<body ng-app="flapperNews" ng-controller="MainCtrl">
    <form ng-submit="addPost()">
        <input type="text" class="form-control" placeholder="Fill in a title" ng-model="title" />
        <input type="text" class="form-control" placeholder="Fill in a link" ng-model="link" />
        <button type="submit" ng-disabled="!title">Add a new post</button>
    </form>
</body>

事实上,它是有效的,但是它做得太多了。当title为空时,它会禁用按钮,这是正确的,但它也会禁用第一个输入字段(在firefox中)。

AngularJS模块:
/* global angular */
var app = angular.module('flapperNews', []);
app.controller('MainCtrl', ['$scope', function ($scope) {
        $scope.posts = [
          {title: "post 1", upvotes: 5},
          {title: "post 2", upvotes: 7},
          {title: "post 3", upvotes: 3},
          {title: "post 4", upvotes: 2},
          {title: "post 5", upvotes: 6}
        ];
        $scope.addPost = function() {
          $scope.posts.push({
            title: $scope.title,
            upvotes: 0,
            link: $scope.link
          });
          $scope.title = "";
          $scope.link = "";
        };
    }]);

我错过了什么吗?如果是这样,为什么它能在除Firefox之外的所有浏览器中完美运行呢?

演示代码:http://embed.plnkr.co/rBQOC9RbroQM5E3bbLZy/preview

更新:

该漏洞无法在Plunker和JSFiddle中复制。显然有缓存问题,Firefox强制刷新解决了这个问题。

显然是缓存问题,Firefox强制刷新解决了这个问题

最新更新