Animations inside forms redirect if method does not return false
See original GitHub issueWhich @angular/* package(s) are the source of the bug?
animations
Is this a regression?
No
Description
I use primitive animation on ngif. The nuance is that if the animation contains state handling ‘:leave’ and the method is called inside the form, then after the animation is completed, there will be a redirect.
Example: was - localhost:123/hello became - localhost:123/hello?
I tried to disable the parent ([@ .disabled] = “noAnimation”) after the animation (@ firstForm.done) = “onAnimationDone ()”, but that didn’t help either.
If the method is called outside the form, then there will be no redirect.
I also found that if in the method that is called inside the form, return false, then there will be no redirect
In the example stackblitz, I created 2 forms for the test
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/angular-ivy-bs8pus
Please provide the exception or error you saw
I would like to understand if this is a bug or not, if not, why is this happening ?
Please provide the environment you discovered this bug in
Angular CLI: 11.0.4
Node: 14.16.1
Package Manager: npm 6.14.12
OS: WIN10 x64
Angular: 12.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1100.4
@angular-devkit/build-angular 12.1.0
@angular-devkit/core 12.1.0
@angular-devkit/schematics 12.1.0
@schematics/angular 12.1.0
rxjs 6.6.0
typescript 4.1.2
Anything else?
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
Prevent redirect after form is submitted - jquery - Stack Overflow
To avoid a redirection or refresh in this process, submit the form info via AJAX. ... If this method is called, the default...
Read more >event.preventDefault vs return false - this vs that
It's recommended to use the preventDefault method instead of return false inside an event handler. Because the latter only works with using the...
Read more >Documentation - </> htmx
With that in mind, consider the following bit of HTML: ... Now any element, not just anchors and forms, can issue an HTTP...
Read more >Django Tutorial Part 9: Working with forms - MDN Web Docs
Creating and handling forms can be a complicated process! Django makes it much easier by providing programmatic mechanisms to declare, ...
Read more >if statement with page redirection javascript - You.com
if($scope.get_logged_status=="false"). maybe the item logged_status in the sessionStorage is considered as string not a boolean , so it returns always true.
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 FreeTop 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
Top GitHub Comments
We talked through it in our team meeting and we decided that this use case is too specific to bake into the framework. Furthermore, we already have all the necessary APIs to do this yourself.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.