Skip to content
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

feat(route): add route generation #139

Merged
merged 1 commit into from
Feb 1, 2016

Conversation

filipesilva
Copy link
Contributor

Heavily, heavily inspired in the angular.io router guide.

This still needs some iteration, but at the moment it works as follows:

Generating a route

You can generate a new route by with the following command (note the singular
used in hero):

ng generate route hero

This will create a folder with a routable component (hero-root.component.ts)
with two sub-routes. The file structure will be as follows:

...
|-- app
|   |-- hero
|   |   |-- hero-detail.component.html
|   |   |-- hero-detail.component.css
|   |   |-- hero-detail.component.ts
|   |   |-- hero-list.component.html
|   |   |-- hero-list.component.css
|   |   |-- hero-list.component.ts
|   |   |-- hero-root.component.ts
|   |   |-- hero.service.ts
|   |-- ...
|-- app.ts
...

Afterwards to use the new route open your main app component, import
hero-root.component.ts and add it in the route config:

@RouteConfig([
  {path:'/hero/...', name: 'HeroRoot', component: HeroRoot}
])

@cironunes
Copy link
Member

@filipesilva please make sure to update this one as well

@filipesilva
Copy link
Contributor Author

Updated it just now.

Edit: It was already up to date, there wasn't any change since my last commit.

@cironunes
Copy link
Member

It's missing the spec files for the services and components, can you add them? Closed #100 in favor of this.

@filipesilva
Copy link
Contributor Author

@cironunes I added the tests on components and services, and also added a e2e test for the command.

@filipesilva filipesilva mentioned this pull request Feb 1, 2016
@Brocco
Copy link
Contributor

Brocco commented Feb 1, 2016

lgtm

@filipesilva filipesilva merged commit 2991dd7 into angular:master Feb 1, 2016
@filipesilva filipesilva deleted the route-generation branch June 13, 2016 16:12
@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 10, 2019
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 this pull request may close these issues.

None yet

3 participants