Skip to content

Due to changes in the router, route generation has been temporarily disabled. #1093

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

Closed
nxpatterns opened this issue Jun 15, 2016 · 65 comments
Closed
Assignees

Comments

@nxpatterns
Copy link

When about it will be available again?

@liangwang320
Copy link

+1

@developer-hosny
Copy link

same here

@filipesilva
Copy link
Contributor

This message is correct and intended as of beta.6. The motivation for this was as follows:

  • router-deprecated was, well deprecated, but was being recommended within the community over router@2.0.0.
  • router@2.0.0 was being completely replaced by router@3.0.0.
  • router@3.0.0 was introduced in http://angularjs.blogspot.ie/2016/06/improvements-coming-for-routing-in.html with the strong recommendation of You should begin using this router right away..
  • router@3.0.0 is conceptually quite different from any of the two previous routers.
  • We didn't have code generation for the new router ready yet.

We felt we wouldn't be doing our users any favors by encouraging the use of router@2.0.0, so it would be better to offer no code generation at all.

We're working to re-add router functionality as fast as possible but I don't have a date for it.

@filipesilva filipesilva added type: enhancement P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful labels Jun 16, 2016
@Brocco
Copy link
Contributor

Brocco commented Jun 17, 2016

To add on to what @filipesilva stated above...

router@3.0.0 is brand new and the usage of it in regards to the style guide will take time to work itself out. After the style guide has adopted a recommended strategy for using the new router the CLI will evaluate to determine how best to follow the style guide recommendations for route generation. If it is determined that the CLI can add value to that part of the developer workflow we will add those features at that time.

@ogookafor
Copy link

Waiting...

@seemsindie
Copy link

+1

1 similar comment
@eudago
Copy link

eudago commented Jun 19, 2016

+1

@neerajyadav
Copy link

waiting..

@jasonswett
Copy link

Let me see if I can help clarify something.

@Brocco @filipesilva Based on your comments I get the impression that it may be more on the order of weeks rather than days until we have route generation capabilities again. Do you think this would be about the right expectation? I'm not saying this to complain, I just want to have a feel for what to expect.

@Brocco
Copy link
Contributor

Brocco commented Jun 20, 2016

@jasonswett I'll try to clarify as best I can.

We have no idea if route generation will be returning let alone when.

The best practices for routing from the style guide are being put together right now. Once they are done with that we will take a look and see if the CLI can/should assist with route generation. Routes are disconnected from components now, and we want to ensure that anything that is added to the CLI will be beneficial for the users. Route definitions are rather straightforward IMO now so I would not be surprised if ng generate route is deprecated, but that is yet to be determined.

@kylecordes
Copy link

I have a somewhat different take on this... more predictive in nature:

  • It is very likely that Angular 2 will become quite broadly used, with lots of tooling available.
  • It is very likely that the most popular CLI a year from now, for Angular 2 will offer route management.
  • It is very likely that the current Google-blessed cli.angular.io in this repo will grow in to that role.
  • But open source is a surprisingly competitive environment. If the current project doesn't get there, it is likely other efforts will pop up. So don't worry too much.
  • As to how fast this happens, that is much harder to guess.

@dancancro
Copy link

Route definitions are rather straightforward IMO

@Brocco in lieu of a generator could you provide a loose step by step for manually changing an angular-cli app to use the new routing?

Something like

  1. Replace system.config.ts with the one from here (or add somehow edit package.json)
  2. Remove the @Routes part of your myapp.component.ts
  3. Create a mycomponent.routes.ts file for each component
  4. and so on

That would be very helpful. Thanks.

@seemsindie
Copy link

I am not up to date but wasn't there a command that you all talked about ng upgrade?
Why is generation disabled, why it's not left for upgrade to fix the current code?

@yusijs
Copy link

yusijs commented Jun 22, 2016

I'm guessing here, but I'd wager the ng upgrade will be available for angular2 final.

@jasonswett
Copy link

This brings up perhaps a good point. I'm not used to the functionality of libraries disappearing even though I haven't upgraded my library version. Wouldn't it be more "normal" to allow ng generate route to continue to function in versions <= 1.0.0-beta.6 (or whatever) and deprecate the feature in the next version?

I had written a number of tutorials that depended on ng route existing, and now those tutorials are somewhat useless since they're no longer followable. It would be nice if I could just say "this tutorial is valid for Angular CLI <= 1.0.0-beta.6" rather than have to rewrite them and have them be broken in the meantime.

@ogookafor
Copy link

Exactly! I mean we could have just used "ng route" till it's deprecation.

On 22 Jun 2016 7:27 p.m., "Jason Swett" notifications@github.com wrote:

This brings up perhaps a good point. I'm not used to the functionality of
libraries disappearing even though I haven't upgraded my library version.
Wouldn't it be more "normal" to allow ng generate route to continue to
function in versions <= 1.0.0-beta.6 (or whatever) and deprecate the
feature in the next version?

I had written a number of tutorials that depended on ng route existing,
and now those tutorials are somewhat useless since they're no longer
followable. It would be nice if I could just say "this tutorial is valid
for Angular CLI <= 1.0.0-beta.6" rather than have to rewrite them and have
them be broken in the meantime.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@ayon06
Copy link

ayon06 commented Jun 29, 2016

have there been any updates on this?

@ghost
Copy link

ghost commented Jun 30, 2016

I understand that the router is evolving quickly, and that the CLI is supposed to uphold best practices, and therefore does not want to lead people down the wrong path by letting people generate routes in a fashion that is likely to be changed soon.

But all I want to know is:
Where can I find some docs on the 3.0.0 router? Or at the 2.0.0.

If we can't automatically generate routes, I'd be happy to manually create them, but I can't seem to find any tutorials.

Could anybody point me in the right direction?

@kylecordes
Copy link

The current published angular.io Router docs cover the "3" router.

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

@ghost
Copy link

ghost commented Jun 30, 2016

@kylecordes I'm sorry, I assumed that they were wrong because they weren't working in an angular-cli app I am developing. But I just went back and checked, and the problem is that my app is not on the 3 router! My bad, it's fine now...

@melloradamj
Copy link

Any progress/updates on this?

@masaanli
Copy link

masaanli commented Jul 6, 2016

Waiting for this.

@val-samonte
Copy link

is there an existing issue reference for the current routing style guide?

@nxpatterns
Copy link
Author

nxpatterns commented Jul 21, 2016

I make it short: any generator without the ability to create routes is USELESS!

A route means at least

  1. Create a directory containing all the necessary files:
  2. Add a Component and give it a name (configurable over cli-parameter, route and component may have completely different names)
  3. Add an appropriate template file
  4. Add an appropriate stylesheet file
  5. Add predefined test-spec files (E2E/Unittest/..)
  6. (Additional/Optional) Add a Service/Model (configurable over cli-parameter)
  7. Last but not least: Register route providers (if it is not already done -> Bootstrapping), create/import route rules or update them etc. etc,..

You have to do all of them manually, that is too much work!

John Papa's great NG2-Snippets unfortunately do not help here,..

@yusijs
Copy link

yusijs commented Jul 21, 2016

1-6 are still done by the cli?

@filipesilva
Copy link
Contributor

@jffry @yusijs the official docs also have updated chapters for the new router, and they're being kept up to date with each release:

@yusijs
Copy link

yusijs commented Jul 21, 2016

@filipesilva I'm aware, I was answering @webia1 :)

@masaanli
Copy link

Currently starting with a big AngularJS 2 application (100+ unique pages)

So i need to create 100 routes ;)

What is the approach the Angular CLI is doing?

Put the routes per route-component or a routes.ts file?

@jasonswett
Copy link

Right now Angular CLI isn't generating routes. I don't exactly how it will implement routes when route generation comes back.

The official Angular docs I've seen seem to want you to put your routes all in one file specifically dedicated to routes.

I've pasted below a route file from an app I'm working on in case it's helpful to see an example.

// src/app/app.routes.ts

import { provideRouter, RouterConfig } from '@angular/router';
import { BookListComponent } from './book-list';
import { NewBookComponent } from './new-book';
import { EditBookComponent } from './edit-book';

const routes: RouterConfig = [
  { path: '', component: BookListComponent },
  { path: 'new-book', component: NewBookComponent },
  { path: 'edit-book/:id', component: EditBookComponent }
];

export const appRouterProviders = [
  provideRouter(routes)
];

(Any further discussion is probably more appropriately had in some other place.)

@iBasit
Copy link

iBasit commented Aug 21, 2016

Guideline should be put on readme file, for how to use route without generator for temporarily.

when route generator will be available again?

@radoslavpetranov
Copy link

radoslavpetranov commented Sep 11, 2016

Any updates on this? Is this feature currently available in master and/or are you planning on enabling it for the next version of CLI that will be switching to RC6? I'm trying to figure out if I should wait some more, if I should just follow the guidelines in your doc and start redoing my deprecated router routes manually or if I should switch to master in case rc6 support and route generation are already enabled there.

Shedding some light on this route generation business would be highly appreciated!

@Brocco
Copy link
Contributor

Brocco commented Sep 12, 2016

Current status on master: adding of routes is still a manual process. But when you generate a module via ng generate module some-feature you can specify the option of routing via --routing which will generating a routing file where you can specify the routes you wish to include within the module.

@radoslavpetranov
Copy link

Thanks for the update, @Brocco !

@EasonPai
Copy link

EasonPai commented Oct 31, 2016

Hi, @Brocco, @radoslavpetranov,
I am 1-week-new to angular, after reading
But when you generate a module via ng generate module some-feature you can specify the option of routing via --routing which will generating a routing file where you can specify the routes you wish to include within the module.

I still have no idea how to do routing, I tried this, but no magic,
ng generate module some-feature --routing

can you give an real case example, thanks

@nxpatterns
Copy link
Author

nxpatterns commented Nov 3, 2016

@EasonPai

ng generate module some-feature --routing 

is correct. If you change to the directory some-feature, you see the files:

some-feature-routing.module.ts   
some-feature.component.css       
some-feature.component.html      
some-feature.component.spec.ts   
some-feature.component.ts        
some-feature.module.ts           

and in the file some-feature-routing.module.ts you will see the routing information:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

const routes: Routes = [];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
  providers: []
})
export class SomeFeatureRoutingModule { }

You see this information in every module, instead of modifying a central file for routing like in Angular2-Seed from MGechev. That's a kind of "using a sledge-hammer to crack a nut",..

I wonder, why not learning from one another??

@Meligy
Copy link
Contributor

Meligy commented Nov 3, 2016

@Brocco can we please remove the route generator completely? Or change the message to say use ng generate route --module instead?

Cheers,

@Brocco
Copy link
Contributor

Brocco commented Dec 8, 2016

Current status of route generation:

You can generate routing modules on new app creation and on module generation using the flag --routing. As of now, generation of individual routes will not be supported.

@Brocco Brocco closed this as completed Dec 8, 2016
@Meligy
Copy link
Contributor

Meligy commented Dec 8, 2016

@Brocco we probably should change this message into something that explains this instead.

Something along the lines of:

To generate a route, use ng generate module with the --routing flag
You can then add your individual routes to the moduleName-routing.module.ts file

Happy to send a PR if the copy is OK, or to use alternative suggested copy.

Cheers,

@Brocco
Copy link
Contributor

Brocco commented Dec 8, 2016

@Meligy A PR with that update would be great!

@peterpeterparker
Copy link

@Brocco shouldn't be the online documentation updated about that?

https://cli.angular.io/reference.pdf

@Meligy
Copy link
Contributor

Meligy commented Dec 9, 2016

  • Interestingly, the route blueprint has been deleted (although the alias r is not cleaned up).
  • The docs in readme need updating.
  • The PDF is very outdated. It'd make sense for cli.angular.io to link to the readme instead.

@RaphHaddad
Copy link

any status on this PR? @Meligy ?

@Meligy
Copy link
Contributor

Meligy commented Jan 18, 2017

@RaphHaddad I have updated the README in #3983 and the PR has been approved, so it should be merged soon.

For now, you can review the updated docs here: https://github.com/Meligy/angular-cli/blob/b391ef8811b0e6c0a3b549708764f814bf860d12/README.md#generating-a-route

@Meligy
Copy link
Contributor

Meligy commented Jan 18, 2017

@RaphHaddad actually it's already cherry picked into master, you can review the newest README from the official repository here https://github.com/angular/angular-cli#generating-a-route

@val-men
Copy link

val-men commented Jan 30, 2017

Should we use https://angular.io/docs/ts/latest/guide/router.html or https://github.com/angular/angular-cli#generating-a-route
I'm a bit confused on how it works. I'm learning how to use Angular2 and I find so many different ways... Which one is the lastest or best practice ?

@danday74
Copy link

please give us some idea of a release date - thanks

@yoneal
Copy link

yoneal commented Feb 16, 2017

@valerianmenin If I'm not mistaken, cli is using the ff https://angular.io/docs/ts/latest/guide/router.html#!#routing-module

@Brocco
Copy link
Contributor

Brocco commented Feb 16, 2017

Specific route generation is not on the roadmap going forward, you can get started with routing by specifying --routing on new project generations and when generating modules. This will provide a routing module to be used to define your routes.

I am locking this thread, if you have issues with what is currently being generated please open a new issue.

@angular angular locked and limited conversation to collaborators Feb 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.