Nobita
Nobita

Reputation: 23

Is there any way to have a name for angular 2 routes?

Is there any way to have named routes in Angular? Maybe something like this

{
  path: '',
  loadChildren: './components/module#Module',
  name: 'namedRoutes'
}

So all I need to do is call the route's name to navigate, not to call the absolute path.

Upvotes: 1

Views: 2324

Answers (2)

Sriram Jayaraman
Sriram Jayaraman

Reputation: 840

Currently there is no way in Angular router for naming the routes. You could use UI-Router for facilitating what you ask for and handle routes even more conveniently.

Upvotes: 0

Sajeetharan
Sajeetharan

Reputation: 222712

There is NO way to have named routes in new Angular2 router. You can read the documentation .

If you really want to use named routes , check this Named Router Outlets in Angular 2. Hope it helps.

Upvotes: 2

Related Questions