Eric Thibeault
Eric Thibeault

Reputation: 91

generator-angular and ui-router

I'm using generator-angular with Yeoman and I'm using yo angular:route XYZ to create new view/controller/route/and test spec.

I know have to use ui-router to implement a multi-step form, based on this one

The questions I have is (and mainly about the use of both angular's router and ui-router):

  1. Is it possible to install ui-route in a "generator-angular" project or as long as I choose another routing, I should stop using this generator? How? A simple bower install angular-ui-router --save
  2. Will I have to create my views/controllers/routing/test-spec seperately from now on since yo angular:route will use the angular router instead of ui-router?
  3. Can both routers work with each other or I have to change all my routing to use ui-router? (in .config, in controllers using $routeParams...).

Thanks for your help on this

Upvotes: 2

Views: 1534

Answers (1)

pedrommuller
pedrommuller

Reputation: 16066

1 - I'm not so sure about your generator (i haven't used it), but since almost all generators are opinonated, if that generator doesn't allow you to choose the router at the beginning then sounds to me like you'll need to look to different options, with cg-angular you can choose use ui-router at the time of the project creation.

2 - if you decide to keep your generator I'm afraid that you'll need to create your routes by hand (that's not a big deal)

3 - I don't think that mix your router providers could be a good idea, I haven't done that yet but they are different implementation for the same purpose so there's a big chance to get a collision between the two and they couldn't work together at all.

In my opinion stick to the ui-router it's quite nice and the migration isn't that painfull and it may worth the change.

Upvotes: 1

Related Questions