Skip to content

NG generate lazy loaded module #8717

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
mbeckenbach opened this issue Dec 1, 2017 · 7 comments
Closed

NG generate lazy loaded module #8717

mbeckenbach opened this issue Dec 1, 2017 · 7 comments
Labels
area: @schematics/angular feature Issue that requests a new feature
Milestone

Comments

@mbeckenbach
Copy link

Versions

Angular CLI: 1.5.5
Node: 6.9.5
OS: win32 x64
Angular: 5.0.4

Feature request

Usually all of our feature modules are lazy loaded.
So the developer has to run at least two commands to create a new module to get our default file layout.

ng g m Foo -- routing
ng g c Foo --flat

Then the developer has to add a default route to the new modules routing module as well as the lazy loading route definition to the nearest parent module.

As the syntax and relative paths are allways the same, wouldn't it be possible to add some flags to combine those stepts?

maybe like this:
ng g module Foo --routing --component --lazy
or even simpler
ng g feature Foo (--lazy)

image

image

@clydin clydin added command: generate P5 The team acknowledges the request but does not plan to address it, it remains open for discussion feature Issue that requests a new feature labels Dec 1, 2017
@tomastrajan
Copy link
Contributor

This can be prototyped with custom schematics eg: ng generate lazy-feature where lazy-feature will be a new schematic which can start as a part 3rd party collection and when stable enough can be included in main @schematics/angular repo?

@mbeckenbach
Copy link
Author

@tomastrajan
Sound very interesting. Is there any link to a guide on creating custom shcematics?

@tomastrajan
Copy link
Contributor

tomastrajan commented Dec 5, 2017

@mbeckenbach check out this talk from Angular Connect 😉

I am also interested in creating custom schematics but until something is done about this issue and this PR you would have to include original @schematics/angular in your schematics and delegate calls for everything you are not implementing yourself.

After the feature is merged it will be possible just to add your own schematics on top of default ones provided by Angular CLI just by adding your own collection in angular-cli.json.

Cheers!

@hansl hansl removed the P5 The team acknowledges the request but does not plan to address it, it remains open for discussion label Feb 1, 2018
@hansl hansl unassigned Brocco Feb 1, 2018
@Robbie106gti
Copy link

They have made it fairly easy to do now, you can just do:
_

ng g m lazy --routing

_

and add the route to your main router file/const

@ngbot ngbot bot added this to the Backlog milestone Jan 24, 2019
@doggy8088
Copy link
Contributor

doggy8088 commented Aug 7, 2019

I think this feature has been implemented in v8.1.0.

fdcd1f7

@clydin
Copy link
Member

clydin commented Aug 7, 2019

Closing as indicated above.

@clydin clydin closed this as completed Aug 7, 2019
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @schematics/angular feature Issue that requests a new feature
Projects
None yet
Development

No branches or pull requests

9 participants