我有一个 angularjs SPA 应用程序,它以 index.html 页面作为主模板,其余 View 作为 ng-view 标记中的 subview 加载。我正在为网站使用 Twitter Bootstrap 模板,因此该模板有一个与其他页面不同的登录页面。有没有办法拥有多个主模板页面,一个用于登录页面,一个用于其他所有页面?我一直在尝试弄清楚如何在路由提供程序中指定不同的页面,但我一直无法弄清楚如何将页面而不是部分 View 指定为 templateURL 或者如果可能的话。
我是 angularjs 的新手,所以我不确定处理这种情况的最佳方法是什么。
谢谢
最佳答案
你在 RouteProvider 的正确轨道上
angular.module('mymodule', ['ngRoute'])
.config(function($routeProvider) {
$routeProvider.
when('/index.html/page1/', {templateUrl : './templates/template1.html'}).
when('/index.html/page2/', {templateUrl : './templates/template2.html'}).
otherwise({redirectTo : '/index.html/page1/'});
});
关于javascript - AngularJS 应用程序多页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19542525/