You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 25, 2023. It is now read-only.
Here's my case scenario: I'm building an upload feature. If the user selects a file with bad data, we show an error message and give them a chance to re-upload the file once they've addressed the changes. Once they start to re-upload the file, I need to be able to remove the error messages and start fresh.
The only way I can do that with this directive is to force the $rootScope.mcMessages message to change.
// function that gets triggered when user initiates upload
$scope.upload = function() {
// First, remove any errors that might have occurred from a previous upload attempt
messageCenterService.reset();
// Shouldn't have to explicitly do this next part but unfortunately I have to
$rootScope.mcMessages = messageCenterService.mcMessages;
// Parse the file
if ( errors occurred ) {
messageCenterService.add("danger", "Error occurred, please try again!");
// Shouldn't have to explicitly do this next part but unfortunately I have to
$rootScope.mcMessages = messageCenterService.mcMessages;
}
}
I feel like the directive itself should be what's refreshing the $rootScope.mcMessages array. Why do I have to do this explicitly myself? Am I missing something here?
Here's my case scenario: I'm building an upload feature. If the user selects a file with bad data, we show an error message and give them a chance to re-upload the file once they've addressed the changes. Once they start to re-upload the file, I need to be able to remove the error messages and start fresh.
The only way I can do that with this directive is to force the
$rootScope.mcMessagesmessage to change.I feel like the directive itself should be what's refreshing the
$rootScope.mcMessagesarray. Why do I have to do this explicitly myself? Am I missing something here?