Wygeneruj moduł z routingiem w kątowym
ng g m [ModuleName] --routing
Perfect Panther
ng g m [ModuleName] --routing
import {Router} from '@angular/router'; // import router from angular router
export class Component{ // Example component..
constructor(private route:Router){}
go(){
this.route.navigate(['/page']); // navigate to other page
}
}
// Here’s a basic example using the navigate method:
goPlaces() {
this.router.navigate(['/', 'page-name']);
}
/*
I hope it will help you.
Namaste
*/
content_copy
ng generate component second
ng new project-name --routing=true