ng new ng5 --style=scss --routing
The above will create a file:
app-routing.module.ts
Inside it modify as follows:
const routes: Routes = [
{
path: '',
component: HomeComponent
},
{
path: 'about',
component: AboutComponent
}
];
Modify your app.component.html as follows:
<!--The content below is only a placeholder and can be replaced.-->
<ul>
<li><a routerLink="">Home</a></li>
<li><a routerLink="about">About</a></li>
</ul>
<router-outlet></router-outlet>
app-routing.module.ts
No comments:
Post a Comment