有没有办法将布尔值(dataLoading)从隔离范围指令传递到另一个元素,以在登录操作期间加载数据时显示进度条?
索引.html
<div class="progress-line" ng-show="dataLoading"></div>
<login-user email = "email" password = "password" show-nav-bar="showNavBar" recover-password="recoverPassword(email)" data-loading="dataLoading"></login-user>
login.component.js
angular
.module('login')
.directive('loginUser', [function() {
return {
scope: {
email: '=email',
password: '=password',
showNavBar: '=showNavBar',
dataLoading: '=dataLoading',
recoverPassword: '&'
},
controller: 'LoginController',
templateUrl: 'login/login.template.html',
};
}]);
login.controller.js
function recoverPassword(email) {
console.log("recoverPassword email: " + email);
$scope.dataLoading = true;
authenticationService.recoverPassword(email, function (response) {
console.log("Response success, status: " + angular.toJson(response.data.status) + " message: " + angular.toJson(response.data.message));
$scope.message = response.data.message;
$scope.dataLoading = false;
});
}