【发布时间】:2015-07-31 08:55:11
【问题描述】:
我在加载内容时使用按钮微调器,当用户点击“搜索”按钮时内容将加载,此时buttonLabel将更改为“正在搜索”并显示微调器(此处按钮将为禁用)。加载内容后(承诺已解决)buttonLabel 将恢复为“搜索”(此处将启用按钮)。
我试过下面的代码,但它总是显示微调器。
HTML:
<button class="btn btn-xs btn btn-blue" ng-click="show()">
<span><i class="glyphicon glyphicon-off"></i></span> {{buttonLabel}}
</button>
脚本:
$scope.buttonLabel = "Search";
$scope.show = function() {
$scope.buttonLabel = "Searching";
$scope.test = TestService.getList( $cookieStore.get('url'),
$rootScope.resourceName+"/students" );
$scope.test.then( function( data ) {
if( data.list ) {
$scope.testData = data.list;
$scope.buttonLabel = "Search";
}
}
}
【问题讨论】:
标签: javascript angularjs twitter-bootstrap