2015-11-06 18 views

回答

0

你可以讓你的索引頁面有一個導航欄和頁腳,然後有一個ng-view div。

您需要包含ngRoute模塊以及鏈接到它的腳本標記。

你會有這樣的div。

<div ng-view=""></div> 

您將看到類似於此的partialRoutes.js文件。

myApp.config(function($routeProvider){ 
    $routeProvider 
    .when('/',{ 
     templateUrl: './partials/things.html' 
    }) 
    .when('/stuff',{ 
     templateUrl: './partials/stuff.html' 
    }) 
    .when('/otherstuff',{ 
     templateUrl: './partials/otherstuff.html' 
    }) 
    .otherwise({ 
     redirectTo: '/', 
    }) 
}); 

當你包含ngRoute它看起來像這樣。

var myApp = angular.module('myApp',['ngRoute']); 這裏是ngRoute的文檔。希望我幫助。

https://docs.angularjs.org/api/ngRoute

相關問題