Creating a new view
Ideally, I’d call it a page, but as what we are building is a single-page app, we don’t technically have different pages. What we do have are views, wherein a view is nothing but a unique URL or route that is linked to a controller and its corresponding partial.
To create a new articles view/page using Yeoman, we simply need to run the following subgenerator command in the terminal:
yo angular:route articles
You’ll now notice that Yeoman has automatically performed the following set of actions:
- Created a new controller named
- Created a new partial named
- Created the files for unit tests within
- Modified the
app/scripts/app.jsfile and added it in the routes for the articles view
Now, isn’t that a lot of manual work you have been saved from!
To know more about the list of generators and subgenerators available on your system, use the following command line:
Yeoman also allows you to create your own generators. The following link gives out more information on how to create or extend a generator: