Angular-cli: what is the state of router implementation?

Created on 27 Sep 2016  Â·  9Comments  Â·  Source: angular/angular-cli

In current condition angular-cli do not provide routes generation. when it is expected to be implemented ? it's a long time since new router has been released. it is a key feature of angular-cli and without this, it's almost nothing and do not add significant value to the end-users.

Most helpful comment

We're working on getting more complete router generation. We have some bits out already, like routing files when generating modules, but are still writing documentation for it.

All 9 comments

I agree with the point that it's a key feature but it's unfair to say it's almost nothing without it, the cli has made development a lot easier with its current features like component/interface generation, serving the application and building it I'm production mode to me is probably if not the best feature.

Angular CLI is great even without the routes !!!
I am working on a project without the CLI and I can defiantly feel the pain!
Any new feature & Routes is welcomed !

It is planned - see #2225. In the meantime you can add routes by following the steps in the docs or the tutorial. I've added routes to a new beta15 angular project and it was fairly painless. Lazy-loading is one thing that you'd probably want to skip for now as the docs state:

Angular provides a built-in module loader that supports SystemJS to load modules asynchronously. If we were using another bundling tool, such as Webpack, we would use the Webpack mechanism for asynchronously loading modules.

@itayJoseph you do not need cli in current state. You can just create a few templates for Pipe, Interfaces, Services, Components etc and use it whenever you need one. Its not much value out of installing angular-cli and using it. There are plenty of angular2 + webpack seeds available to start with.
@bonnici I agree we have no option other than to use the angular.io. so the current state of cli is simply useless.

Definitely not useless for me - I'm using angular-cli to make components and then just making some small changes to add the routes manually when I need to. It should just be a matter of making an app.routing.ts file, including an export and a provider in the app.module.ts file, and adding a router-outlet to your main component as explained in the angular.io docs.

We're working on getting more complete router generation. We have some bits out already, like routing files when generating modules, but are still writing documentation for it.

Thanks for the update @filipesilva.

@bonnici – lazy loading works fine right now with webpack. In fact it is the only way I have been able to get hierarchical routing working. By hierarchical routing I mean where the root routing file only has roots for top level navigation. Each subsequent sub-level has roots just for that level. See this stack overflow: http://stackoverflow.com/a/39638391/5348742

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._

Was this page helpful?
0 / 5 - 0 ratings