【发布时间】:2014-05-17 20:43:35
【问题描述】:
我无法弄清楚为什么我的简单 AngularJS 应用程序无法按预期工作。 “正在加载...”应该被隐藏,“完成!”应在 1 秒后显示。
html:
<div ng-app>
<div ng-controller="TestCtrl">
<div class="text-center" ng-show="loading">
<h1>Loading...</h1>
</div>
<div class="text-center" ng-show="!loading">
<h1>Done!</h1>
</div>
</div>
</div>
Javascript:
function TestCtrl($scope) {
$scope.loading = true;
setTimeout(function () {
$scope.loading = false;
}, 1000);
}
【问题讨论】:
-
这篇文章很有帮助,但标题不适合谷歌搜索。
标签: javascript angularjs ng-show