角UI路由器-具有多个布局的嵌套状态
my-module.js
'use strict';angular.module('my-module', ['ngResource', 'ui.router']) // Routing for the app. .config(function ($stateProvider, $urlRouterProvider) { $stateProvider .state('root', { url: '', views: { 'layout': { templateUrl: 'partials/layout/1-column.html' }, 'header': { templateUrl: 'partials/layout/sections/header.html' }, 'footer': { templateUrl: 'partials/layout/sections/footer.html' } } }) .state('root.home', { url: '/' }) .state('root.signup', { url: '/signup', views: { 'step-breadcrumb': { templateUrl: 'partials/signup/step-breadcrumb.html' } } }) ; $urlRouterProvider.otherwise('/'); }) ;
index.html
<!doctype html><html class="no-js" ng-app="my-module"> <head> <meta charset="utf-8"> <title>My Test App</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width"> <!-- build:css({.tmp,app}) styles/main.css --> <link rel="stylesheet" href="styles/main.css"> <!-- endbuild --> <!-- build:js scripts/modernizr.js --> <script src="bower_components/modernizr/modernizr.js"></script> <!-- endbuild --> </head> <body> <div ui-view="layout"> </div> <!-- build:js({app,.tmp}) scripts/vendor.js --> <script src="bower_components/angular/angular.js"></script> <script src="bower_components/angular-resource/angular-resource.js"></script> <script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script> <!-- endbuild -->
蛊毒传说
相关分类