2015-09-29 40 views
0

給定一個空文檔,只需最基本的要素,裝載JS文件和樣式表:在載入控制器角局部視圖入空文檔

<!doctype html> 
<html ng-app="labApp"> 
    <head> 
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.min.js"></script> 
    <script src="/static/lab.js"></script> 
    <link rel="stylesheet" href="/static/local.css" /> 
    <link rel="stylesheet" href="/static/superhero.min.css" /> 
    </head> 
    <body ng-controller="labController"> 
    </body> 
</html> 

而在lab.js空控制器:

angular.module('labApp', []) 
    .controller('labController', function() { 
    var lab = this; 
    }); 

我如何着手將局部視圖加載到身體中? 我應該這樣做手動,使用jQuery,還是有一些隱藏的角度來加載部分? https://github.com/angular-ui/ui-router

當加載到你的應用程序,你可以將其包含這樣的

angular.module('app', [ui.router]) 

當您按照它是相當的文檔:

+0

你可能要考慮使用ui路由器:https://github.com/angular-ui/ui-router – Michelangelo

+0

啊,是的,這似乎是失蹤的齒輪..請添加一個答案,以便我可以接受它^ _ ^ –

回答

0

您可以通過渲染與UI的路由器不同的看法做到這一點易於設置不同的路線。祝你好運!