我想在调用function2时隐藏function2内的function1的flash消息。
我已经给出了超时以淡出flash消息。但需要在超时之前淡出其他功能内特定功能的flash消息。
$scope.function1 = function() {
var response = {
"json":
{
"response":
{
"status": "Success"
}
}
};
if (response.success != undefined) {
FlashService.Success(response.message);
window.scrollTo(500, 0);
$timeout(function(){
delete $rootScope.flash;
}, 9000);
} else {
if(response.json.response.status == "Success") {
FlashService.Success("Updated successfully", true);
window.scrollTo(500, 0);
$timeout(function(){
delete $rootScope.flash;
}, 9000);
} else {
FlashService.Success(response.json.response.status);
window.scrollTo(500, 0);
$timeout(function(){
delete $rootScope.flash;
}, 9000);
}
}
};
$scope.function2 = function() {
console.log("Inside function2");
};
$scope.function1();
<button class="btn btn-primary" ng-click="function2()">Call</button>