[英]Multiple master page angularjs
I'm starting a new project and am going to be using angularjs. 我正在开始一个新项目,并且将使用angularjs。 The page structure is the follow: 页面结构如下:
/views
loginView.html
mainView.html
loginMaster.html
mainMaster.html
My problem is set the other master page(mainMater.html) after the login. 我的问题是登录后设置了另一个母版页(mainMater.html)。
The routing function is follow: 路由功能如下:
mainapp.config(['$routeProvider',function($routeProvider) {
$routeProvider.when('/login', {
controller : 'loginController',
templateUrl : '/views/loginView.html'
}).when('/', {
controller : 'mainController',
templateUrl : '/views/mainView.html'
}).otherwise({
redirectTo : '/login'
});
}]);
AngularJS is great for single page applications, which means if you exit the context of javascript by loading an entirely new page, you'll have to setup the context again. AngularJS非常适合单页应用程序,这意味着如果您通过加载全新的页面退出javascript上下文,则必须再次设置上下文。 I would recommend you to have just one master page (load the page from the server once and perhaps have something like:) 我建议您只有一个母版页(从服务器加载该页一次,也许有类似以下内容:)
<html ng-app="myApp">
...
<body>
<div class="container" ng-view>
and keep changing the entire view within the ng-view context. 并继续在ng-view上下文中更改整个视图。 Have the login screen, signed in experience, all of it in the same place. 将登录屏幕和登录体验都放在同一位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.