This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ngRouter: Multiple controller initialization when search changed #16632
Comments
I think it is b607618 😇 Interesting that nobody complained for almost 1.5 years. This is clearly broken 😁 |
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Jul 19, 2018
3 tasks
Should be fixed by #16636. In the meantime, you can hack around the issue like this: myApp.decorator('$browser', $delegate => {
const originalUrl = $delegate.url;
$delegate.url = (...args) => {
const result = originalUrl.apply($delegate, args);
return angular.isString(result) ? result.replace(/#$/, '') : result;
};
return $delegate;
}); DISCLAIMER: This is a total hack, relies on private APIs and is not recommended. Use at your own risk 😁 |
Many thanks for prompt fix. Have not expected this. |
You definitely should have 😠 This one was quite serious (combined with routing and non-trivial route initialization logic). |
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Jul 25, 2018
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Jul 26, 2018
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm submitting a ...
Current behavior:
Controller is initializing multiple times while search changed with ngRouter.
Expected / new behavior:
Single search change should only trigger controller initialization once.
Minimal reproduction of the problem with instructions:
index.htm
app.js
http://plnkr.co/ZjIq1gb6hKgqPrNjsKZ0
AngularJS version: 1.6.2 and above (checked with 1.6.2, 1.6.9, 1.7.1, 1.7.2). The last version that is not affected -- 1.6.1
Browser: [all]
The text was updated successfully, but these errors were encountered: