Questions tagged [angular-ui-router]

UI-Router evolves the concept of an AngularJS Route into a more general concept of a State for managing complex application UI states. Most notably, it allows nested state/view hierarchies and multiple named views.

UI-Router

UI-Router is a routing module created by the Angular-UI team that replaces the built-in $route/$routeProvider in Angular.

Its most notable advantage is that it uses states which, while similar to routes, allow you to describe your application as a collection of states. A state being comprised of optional parameters, such as a url, template, controller and resolved dependencies. States can be nested (parent/child relationship), multiple views can be used in a single state, and urls can be appended or absolute.

A question that would be a good candidate for using the ui-router tag would:

  • Pertain to a project that is:
    • built on the AngularJS framework
    • using or is migrating to UI-Router (over $routeProvider and ng-view)
  • Not be easily answered by the UI-Router Github Wiki. Be sure to check the FAQ!
  • Show all the various files related to the issue. State configurations, Controllers, Templates, other.
10400 questions
3
votes
1 answer

angular-ui-router nested views the page doesn't loading when direct url is used or refresh

I have this plunker which works fine it's better seeing here but there's one bug in there, when navigating to nested state through a clickable link I get the desired behavior, but when refreshing the page or writing the URL and pressing enter the…
Yahya KACEM
  • 2,481
  • 7
  • 34
  • 61
3
votes
0 answers

ui-router not rendering view

I have something odd, probably missed some trivial step along the way. In the console I have the following... $stateChangeStart to undefined- fired when the transition begins. toState,toParams : [object Object] [object Object] …
Bill Gauvey
  • 95
  • 1
  • 5
3
votes
1 answer

how to make angularjs call to nodejs api and auth with stormpath

The following code starts in angularjs, then is routed through node which then should make an external api call. What is happening, stormpath is intercepting the call and trying to authenticate it (the login screen is served...I checked res.data). I…
Will Lopez
  • 2,089
  • 3
  • 40
  • 64
3
votes
2 answers

'ShouldWorkController' is not a function. Got undefined

When I try to bind a controller to a template using the angular-ui-router $stateProvider, I run into the following error: 'ShouldWorkController' is not a function. Got undefined. However, when I declare the controller inside the template using…
xvdiff
  • 2,179
  • 2
  • 24
  • 47
3
votes
1 answer

Excluding path in url using AngularJS

My angular application has multiple pages which users can visit and I would like to hide all other urls and only show users the base url. So imagine my base url is: www.example.com and I have other pages like About, Contact Us etc. Currently, when…
k.ken
  • 4,973
  • 5
  • 23
  • 21
3
votes
3 answers

Angular ui-router not loading controller or template

I seem to have an issue getting ui-router to actually route things. I am sure that all of my javascript files are being loaded and angular isn't throwing any errors. I have an HTML file that declares the app and base controller and then I load the…
Nolski
  • 443
  • 4
  • 8
  • 24
3
votes
1 answer

onEnter and onExit are not called when state is left/activated in angularjs ui router

This is my plunker http://plnkr.co/edit/GMfMcXgHguYjFYoxWEaM 1.) click the above live demo link 2.) click the "create" button which should activate the projects.create state 3.) an alert() should pop up now but it does not. Why are those onExit and…
HelloWorld
  • 4,671
  • 12
  • 46
  • 78
3
votes
2 answers

Angular UI Router issue when redirecting to a template after resolve() throws error

So It took me a very long time to understand this issue and get to a mcve. Here is the case : I'm trying to redirect a user to a login page when he's not authenticated (this is very basic). Here is the code : HTML :
Jeremy Belolo
  • 4,319
  • 6
  • 44
  • 88
3
votes
1 answer

How can I get AngularJS ui-router to respond correctly to a browser page refresh?

I have created an AngularJS application that uses ur-router. Here's a small sample of the config: $locationProvider.html5Mode(true); var admin = { name: 'admin', url: '/Admin', views: { 'root': { …
Samantha J T Star
  • 30,952
  • 84
  • 245
  • 427
3
votes
1 answer

AngularJS ui-router: receive an event every time a user goes to a state

I need to receive an event in AngularJS ui-router when the user goes to a state, even when they go to that state twice in a row (i.e. clicking the same url twice). For example, in this plunk, you will only be notified the first time you click on the…
ps0604
  • 1,227
  • 23
  • 133
  • 330
3
votes
1 answer

Angular UI-Router templateUrl Issue

I am still learning the UI-Router for AngularJS and have was hoping to get some help. I am taking advantage of the nested views functionality, but running into some hiccups. My top level parent state works, but as soon as I start creating children,…
Austin
  • 75
  • 2
  • 6
3
votes
1 answer

Right click ui-sref links / new tab doesn't work as expected

It's pretty standard to be able to right click or ctrl click a link and open that link in a new tab. Angular ui router ui-sref's don't honor this at all. Any ideas on how this should be done? It has to be inside the framework clearly I can't do all…
httpete
  • 2,765
  • 26
  • 34
3
votes
1 answer

Angular ui-router: keep same ui-view for child

I need child state be able to use parent state's resolve functions. But I also need to keep same ui-view for both states. Here's a fiddle. And there's a code $stateProvider .state('parent', { url: "/", template:…
Timofey Trofimov
  • 1,134
  • 3
  • 12
  • 26
3
votes
2 answers

Change state of angular app from resolve method of state provider

I'm using ui-router in my angular application. Currently I've two routes /signin & /user. Initially it shows /signin when the user clicks on the login button, I'm sending a ajax request and getting the user id. I'm storing the user id in…
Indranil Mondal
  • 2,799
  • 3
  • 25
  • 40
3
votes
1 answer

AngularJS ui-router redirect after log in

I have a project using AngularJS with ui-router. Everything working fine beside the redirect from login screen to preview state on the first load. Default state is home - http://test/#/ For example, if user is not logged in -…
Valter
  • 2,859
  • 5
  • 30
  • 51
1 2 3
99
100