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 has been archived by the owner on Apr 25, 2023. It is now read-only.
Coming from $state.go(...) (https://github.com/angular-ui/ui-router), $locationChangeSuccess is called AFTER controller are initialized and views are loaded. This causes a small problem displaying messages.
Scenario:
I call $state.go('newState') and controller A gets initialized.
controller A has a method init() which will call messageCenterService.add('info', 'Message', options);
AFTER this, angular will now broadcast $locationChangeSuccess and the following happens:
// Update 'unseen' messages to be marked as 'shown'.
messageCenterService.markShown();
// Remove the messages that have been shown.
messageCenterService.removeShown();
Because the newly created info-message is in an 'unseen' state, it will be marked as 'shown' and removed. Due to this, after everything is loaded, user can't see the message.
Workaround for this is to also listen to $locationChangeSuccess in controller A and recall the message.
$rootScope.$on('$locationChangeSuccess', function locationChanged(event, to) {
showMessage();
});
But this needs a better solution, not a hack.
The text was updated successfully, but these errors were encountered:
Coming from $state.go(...) (https://github.com/angular-ui/ui-router), $locationChangeSuccess is called AFTER controller are initialized and views are loaded. This causes a small problem displaying messages.
Scenario:
I call
$state.go('newState')
and controller A gets initialized.controller A has a method
init()
which will callmessageCenterService.add('info', 'Message', options);
AFTER this, angular will now broadcast $locationChangeSuccess and the following happens:
(https://github.com/e0ipso/message-center/blob/master/message-center.js lines 125-132)
Because the newly created info-message is in an 'unseen' state, it will be marked as 'shown' and removed. Due to this, after everything is loaded, user can't see the message.
Workaround for this is to also listen to $locationChangeSuccess in controller A and recall the message.
But this needs a better solution, not a hack.
The text was updated successfully, but these errors were encountered: