我使用 AngularJS 构建了一个 SPA。我想要页面和管理仪表板有两种不同的布局。
我当前的index.html 看起来像这样
<!DOCTYPE html>
<html data-ng-app="AngularApp">
<head>
....
</head>
<body>
<div>
//some code for navbar and others stuff that doesn't change
</div>
<div data-ng-view="">
//here are loaded all the content
</div>
我想做一个具有不同内容和导航栏的不同页面供管理员使用。 如何切换到具有不同 css、js 等的完全不同的布局。 基本上是第二个index-admin.html,它将加载 Angular 、 Bootstrap 、js、css 以及从顶部开始的所有内容 有任何想法吗? 像这样设置路由
.when("/admin", {
controller: "adminController",
templateUrl: "/app/admin/views/index.html"
});
将内容加载到
<div data-ng-view=""></div>
我不想要
最佳答案
看看https://github.com/angular-ui/ui-router
支持嵌套 View ,允许您为管理员用户提供具有不同布局的基本 View
关于javascript - AngularJS + SPA - 更改布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27696713/