Nicu
Nicu

Reputation: 3536

I have a error when I try to swich the old angular 2 router with the new Router

I have the main app component and under the admin component I want to add subroutes like /admin/users, /admin/subscribers

@Component({
    selector: 'my-app',
    template: `<router-outlet></router-outlet>`
    directives: [ROUTER_DIRECTIVES]
    })
@Routes[
new Route({
                path: '/admin/...',
                //name: 'Admin',
                component: AdminPage
            })
]

And this is the configuration for the admin component

@Component({
    selector: 'admin-Page',
    templateUrl: applicationPath + '/adminPage.html',
    directives: [ROUTER_DIRECTIVES]
})
@Routes([
    new Route({
        path: '/users',
        component: UsersPage,
        // name: 'Users',
        // useAsDefault:true
    }),
    new Route({
        path: '/subscribers',
        component: SubscribersPage,
        // name: 'Subscribers'
    })
]

...but the problem is that the application does not recognize the route /admin/users. With the new router is this behaviour not supported any more? Does it just have a different syntax?

Upvotes: 0

Views: 87

Answers (1)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 657721

You don't need /... in RC.1 router anymore to indicate there are child-routes.

Upvotes: 3

Related Questions