angular / router

The Angular 1 Component Router
MIT License
665 stars 135 forks source link

Nested routing /views #382

Open ghost opened 8 years ago

ghost commented 8 years ago

I am creating an admin template using this latest routing .This works as follows - 1)index.html load with login component as ng-viewport. 2)after login i want a base component with header,footer,and menus to load in the ng-viewport of index.html and upon calling specific page like add user page ,i want to load user component to load in another ng-viewport of my base component .So it will be like -- index.html (ng-viewport)--->base.html(ng-viewport)--->addUser.html or index.html (ng-viewport)--->base.html(ng-viewport)--->someothercomponent.html

How can i achieve this ? My approach --->

1)app.module.js

var app = angular.module('app', ['ngNewRouter', 'ngResource', 'kendo.directives']).controller('AppController', ['$router', AppController]);

function AppController ($router) {

}

2)app.route.js

AppController.$routeConfig = [ { path: '/', redirectTo: '/home' }, { path: '/home', component: 'home' }, { path: '/login', component: 'login' }, { path: '/signup', component: 'signup' }, { path: '/app', component : 'base'}

];

3)base.js

app.controller('BaseController', function($router) {

$router.config([

{ path: '/app/dashboard', component: 'dashboard' },
{ path: '/app/reports', component: 'reports' },
{ path: '/app/vouchers', component: 'vouchers' },
{ path: '/app/transactions', component: 'transactions' }

]);

}); I m getting this error in my firebug console :::: Error: instruction.viewports[Object.keys(...)[0]] is undefined with no success Need help :(