How can i use wildcard routing in Angular2/4

301 views Asked by At

I am new to angular2/4. I want to use the wildcard routing in angular. also on wildcard routing. I want to call some action/method.

Thanks

2

There are 2 answers

0
Robert On

HI can you do like this

        {
            path: '**',
            component: NotFoundComponent
        }

source angular.io

0
Christian On

Even if you use wildcard-routing you'd have to point to a component to load:

{
    path: '**',
    component: YourComponent
}

Then in your component you could call your action in the ngOnInit.