Creating new views Harness the power of the new Angular CLI

Generate Component

Using the CLI, nagivate into the directory you want the new component, then simply:

ng generate component new-view

The CLI will do the heavy lifting and create the following with corresponding names:

It will also attempt to update your app module file. Double check and make sure your new component is imported into app.module.ts:

for example in app.module.ts:

{{ newViewRootTypescript }}

And define those declarations/imports in @NgModule:

{{ newViewFeatureTypescript }}

next we'll need to create a route for this component, edit app.routes.ts:

{{ newViewRouteTypescript }}

and add a new path with the url you desire for this route:

{{ newViewPathTypescript }}

Now you can use this new route in your main nav or wherever you like!

Generate Docs