Angular CLI route

Just like the error says, route generation is temporarily disabled in angular-cli. The reason being older router getting deprecated. Angular2 rc4 uses the new router and any new project based on angular 2 should ideally use the new router. So till angular cli updates to support new router directives, we have to manually create the router files & import required dependencies.

This is what worked for me.

  • Use angular-cli to create the seed project
  • Generate new components using ng g component
  • Then manually add router to these components using this tutorial

    https://angular.io/docs/ts/latest/guide/router.html


use :

ng g m route --routing
  • g-> generate
  • m-> module
  • route-> Your route Module Name(You can use any name).

ng generate module app-routing --flat --module=app

--flat puts the file in src/app instead of its own folder.

--module=app tells the CLI to register it in the imports array of the AppModule

Check the details here