angularjs - Angular best practices for layouts -


i have admin dashboard application called dashboard.html initiated own angular module. application has consistent layout n header bar @ top, left bar navigation etc. when route changes content container gets updated , rest of layout stays unaffected.

my problem login page, different layout, without header bars , navigation.

currently i'm solving issue creating login.html file own module, when user login, redirect them dashboard.html app.

is general used approach or there clean way of doing in single application, changing routes , not redirecting different apps?

you can use angular uirouter doing this.

have @ fiddle, http://jsfiddle.net/thardy/ed3mu/.

   <div ui-view="main"></div>    angular.module('myapp', ['ui.state']) .config(['$stateprovider', '$routeprovider',       function ($stateprovider, $routeprovider) {         $stateprovider             .state('test', {                 abstract: true,                 url: '/test',                 views: {                     'main': {                          template:  '<h1>hello!!!</h1>' +                                     '<div ui-view="view1"></div>' +                                     '<div ui-view="view2"></div>'                     }                 }             })             .state('test.subs', {                 url: '',                 views: {                     'view1@test': {                         template: "im view1"                     },                     'view2@test': {                         template: "im view2"                     }                 }             });     }])     .run(['$rootscope', '$state', '$stateparams', function ($rootscope,   $state, $stateparams) {         $rootscope.$state = $state;         $rootscope.$stateparams = $stateparams;         $state.transitionto('test.subs');     }]); 

you can create main views , sub-views app, app can create main views login , dashboard pages, , can load sub-views in dashboard page required.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -