Notify: false prevents state transition entirely (not just events)
See original GitHub issueHi,
I’ve created a Plunker here
As shown in the example I think one would expect to be able to use event.preventDefault()
in the $stateChangeStart
event to prevent a transition, then later trigger that same transition manually with {notify: false}
to prevent the event being triggered and therefore the state transition being blocked again (infinite loop).
However the viewDirective
is relying on $stateChangeSuccess
internally which is also prevented by {notify: false}
.
One work around is like so:
$state.go(toState.name, toParams, {notify: false}).then(function() {
$rootScope.$broadcast('$stateChangeSuccess', toState, toParams, fromState, fromParams);
});
I think perhaps the best solution here would be to use an alternative event internally to trigger the updateView()
in viewDirective
, or alternatively extend notify
to target start/success events separately.
Thanks
Issue Analytics
- State:
- Created 9 years ago
- Comments:19 (7 by maintainers)
Top Results From Across the Web
Bubbling and capturing - The Modern JavaScript Tutorial
To stop the bubbling and prevent handlers on the current element from running, there's a method event. stopImmediatePropagation() .
Read more >Script Syntax - Home Assistant
alias: "Notify about the state of the blind" service: notify.mobile_app_iphone ... When a condition does not return true , the script will stop...
Read more >Fact check: 20 false and misleading claims Trump made in his ...
Former President Donald Trump began his 2024 presidential campaign just as he ended his presidency in 2021: with a whole lot of inaccuracy....
Read more >Behavior changes: Apps targeting Android 12
Learn about changes in Android 12 that will affect apps when they target Android 12.
Read more >Create, test, and tune a DLP policy - Microsoft Learn
This is an effective way to introduce DLP policies to your end users, and do user awareness training, without risking too many false...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For anyone searching, there will not be updates on this issue because 1.0 deprecates the state events.
{notify: false}
no longer has any effect.@pootzko that depends on what you’re trying to do (assuming with notify: false). In @homerjam’s example, I think managing the infinite loop using a separate variable like
retryInProgress
would work.@leonpapazianis yes, it is on the roadmap. You can use the proof-of-concept I added to ui-router-extras for now. See #1257 for details. I think code like this should work: