I am using button spinner while loading the content, when the user clicks on the Search button content will load, at this time buttonLabel
will be changed to Searching and spinner will be shown (Here button will be disabled). After loading the content (Promise resolved) buttonLabel
will be reverted back to Search (button will be enable here).
I have tried the below code, but it is always showing the spinner.
HTML :
<button class=btn btn-xs btn btn-blue ng-click=show()>
<span><i class=glyphicon glyphicon-off></i></span> {{buttonLabel}}
</button>
Script :
$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;
}
}
}
Updated Fiddle : http://jsfiddle.net/xc6nx235/18/