母版页观AngularJS? [英] Master Page Concept in AngularJS?
问题描述
我想创建母版页,这是将在应用程序的所有视图中使用的主网页。
I would like to create master page, that is main page which will be used in all views of the application.
例如,左侧的导航和顶级男装导航。该导航应该显示在各方面的意见,在应用时的URL变化。
For example, Left navigation and top men navigation. This navigation should be displayed in all the views, whenever url changes in application.
根据NG-认为,只呈现给出部分观点和替换previous视图。在以上所有的左边和顶部导航的形象要通过角控制器来显示。
As per ng-view, it only renders given partial view and replace previous view. In the image above all my left and top navigation should be displayed by using angular Controller.
控制器code
angular.module('modelDemo').controller("authCtrl", ['$scope', function($scope) {
$scope.list;
}]);
请让我知道,我怎么能做到这一点。
Please let me know, how can i achieve this
推荐答案
您可以使用角路由或角的UI路由器,并设置你的主人,按照此步骤:
You can use angular-route or Angular-ui-router, and setting your master, following this steps:
- 第1步。您的
index.html的
您的母版页。 - 第2步:添加
<头>
,<页脚>
,<一边>
,< DIV>
等,通过引用您的模板NG-包括
- 注:您的左边和顶部导航将成为它的一部分
- Step 1. Make your
index.html
your master page. - Step 2. Add the
<header>
,<footer>
,<aside>
,<div>
, etc. referencing your templates by usingng-include
- NOTE: your left and top navigation will be part of it
来源:
- 采用了棱角分明路线: https://docs.angularjs.org/tutorial/step_07
- 模板,一个全新的应用程序: https://github.com/angular/angular-seed
- using Angular Route: https://docs.angularjs.org/tutorial/step_07
- template for a brand-new app: https://github.com/angular/angular-seed
这篇关于母版页观AngularJS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!