In my app componenent, i have the following code
import { Component, OnInit} from '@angular/core';
import {aComponent} from './a.component';
import {xService} from './shared';
import {Router, Routes, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from @angular/router';
import {zComponent} from './z.component';
@Component({
moduleId: module.id,
selector: 'my-app',
templateUrl: 'x.component.html',
styleUrls: ['x.component.css'],
directives: [
ROUTER_DIRECTIVES],
providers: [
ROUTER_PROVIDERS, cService
]
})
@Routes([
{
path: '/',
component: zComponent
},
{
path: '/admin',
component: aComponent
}
])
export class AppComponent implements OnInit {
constructor(private _router: Router) { }
ngOnInit() {
}
When I type the following URL urlserver/ it works fine , my zcomponent is displayed But when I type the following url urlserver/admin , an error occurs (The requested URL /admin was not found on this server.)
what's happend ? Why does not the code work ?