I implemented the following console outputs to keep track of what was done and what wasn’t. Code for the page under / dataList.
export class DataList implements OnInit {
constructor(private service: DataService) {
console.log("constructed");
}
ngOnInit() {
console.log("inited");
...
}
}
Now it works as intended, providing both outputs (i.e., designed and located) in the console when accessing the page , entering the URL , and also when accessing the page using routing from another page , as shown below.
this.router.navigateByUrl("/dataList");
( URL-, /dataElement/ 12345, 12345, ) ( ), /dataList URL-. ( F5, , .)
, , ngOnInit
, , , , ( ).
, , , . , , . Googling , ( this). .
const routes: Routes = [
{ path: "", component: StartComponent },
{ path: "dataList", component: DataListComponent },
{ path: "dataElement/:id", component: DataElementComponent },
...
{ path: "**", component: StartComponent }
];