<分区>
我基本上是在恢复这个question ,但对我来说,它发生在页面加载时略有不同。
//HTML
<h1>Some very serious message here</h1>
<div ng-app="myApp" ng-controller="MyCtrl">
<div ng-if="text !== ''">
<label class="alert alert-danger">{{text}}</label>
</div>
</div>
//JS
var myApp = angular.module('myApp', ["ngAnimate"]);
myApp.controller('MyCtrl', function($scope) {
$scope.text = '';
});
参见 JSFiddle .
为什么我能看到(即使很快)标签?如果我将 ng-if
更改为 ng-show
,也会发生同样的情况。