Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why ui-view doesn't work into components template? #2574

Closed
tamtakoe opened this issue Feb 21, 2016 · 20 comments
Closed

Why ui-view doesn't work into components template? #2574

tamtakoe opened this issue Feb 21, 2016 · 20 comments
Assignees
Milestone

Comments

@tamtakoe
Copy link

http://plnkr.co/edit/SKYVVGWw2GqABPoQHg8E?p=preview

@kukac7
Copy link

kukac7 commented Feb 21, 2016

@tamtakoe missing $urlRouterProvider.otherwise('/');
http://plnkr.co/edit/EtfH7yyh4pFOuxssUAYV?p=preview

@tamtakoe
Copy link
Author

@kukac7 I have updated my plnkr (added otherwise and templateUrl). It works good but only in plnkr. On local server it doesn't work. This is problem in templateUrl

@kukac7
Copy link

kukac7 commented Feb 22, 2016

@tamtakoe there's nothing wrong with it, works well.
i do not know that there is a local development environment set for you, but for me there is no problem.

@eddiemonge
Copy link
Contributor

If it doesn't work locally but does work elsewhere then I would examine your local setup to see whats different. Closing as this doesn't seem like a ui-router issue.

@tamtakoe
Copy link
Author

tamtakoe commented Mar 8, 2016

@eddiemonge, @kukac7 This problem occurs because of $location service. See example:
http://plnkr.co/edit/kXcik8znN5HMp6ohRuMA?p=preview

If you remove problem service, app will works good

@eddiemonge
Copy link
Contributor

That looks like a core angular problem

@eddiemonge
Copy link
Contributor

It doesn't matter what you put into the run argument list, even nothing in there breaks it.

@tamtakoe
Copy link
Author

tamtakoe commented Mar 9, 2016

I created an issue in angular repository angular/angular.js#14201

Investigate this problem, please. In what place and what time it appear. I or Angular team can not do it effectively, because we are not ui-router specialists.

@Narretz
Copy link

Narretz commented Mar 9, 2016

This might be a problem similar to angular/angular.js#1213 (A fix for this was merged, but it's not in a release yet). But the exact problem is different. With uiRoute, injecting location breaks the state update. I would say that this is a uiRouter bug.

@eddiemonge eddiemonge reopened this Mar 9, 2016
@eddiemonge eddiemonge added the bug label Mar 9, 2016
@tamtakoe
Copy link
Author

It works if you add $state near $location dependency http://plnkr.co/edit/GlZgwMSJjuSt0AVjT2zc?p=preview

@gkalpak
Copy link

gkalpak commented Mar 10, 2016

This was indeed an issue very similar to the one pointed out by @Narretz.
This seems to have been fixed in v1.0.0alpha0: updated plnkr

@gkalpak
Copy link

gkalpak commented Mar 10, 2016

This is the original commit that fixed this if anyone is curious: 46cf53d

@tamtakoe
Copy link
Author

👍

@christopherthielen
Copy link
Contributor

Thanks all. For others, the @tamtakoe workaround is simple:
app.run(['$state', function($state) {}]);

@christopherthielen
Copy link
Contributor

Fixed in de3a04a
released as 0.3.0

@mickaeltr
Copy link

mickaeltr commented Oct 30, 2017

Hi @christopherthielen,

I am working on a legacy project with Angular 1.5 and ui-router 0.2. I am trying to upgrade it progressively to newer versions. Upgrading to ui-router 0.3 or 0.4 breaks the history.back() behaviour (if I go from state1 to state2 to state3 then back, it goes back to state1 instead of state2).

I figured out that replacing .constant("$state.runtime", { autoinject: true })
by .constant("$state.runtime", { autoinject: false }) fixes it.

Any idea? Many thanks

@christopherthielen
Copy link
Contributor

@mickaeltr Not sure. I don't think the constant $state.runtime is used by either ui-router or angularjs. I suspect your app might have custom code that uses that value?

@mickaeltr
Copy link

@christopherthielen More precisely, my problem actually comes from $injector.get('$state'); (in the run block), which is executed when $state.runtime.autoinject is true. Sorry for my bad explanation!

@christopherthielen
Copy link
Contributor

As for the back button, I'd try the latest version 1.0.10

@mickaeltr
Copy link

I'd like that but upgrading ui-router from 0.x to 1.x requires quite some work. So for now we'll have to stick to 0.2.18. Thanks @christopherthielen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants