Bob*_*Bob 5 html twitter-bootstrap angularjs ngroute
我使用AngularJS 1.4.1,ngRoute 1.4.1和https://angular-ui.github.io/bootstrap/
基础结构是
<html ng-app="myApp">
<base href="/">
<body>
<div ng-view></div>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
我使用ngRoute加载我的网站的每个页面,例如关于,联系我们等...进入带有ng视图的div.
使用时将页面加载到ng视图中
var myApp = angular.module('myApp', ['ngRoute', 'ngProgress', 'ui.bootstrap']);
myApp.config(function($routeProvider,$locationProvider){$routeProvider
.when('/about',{templateUrl:'about.php',controller:'mainController'})
.otherwise({redirectTo:'/'});
staffPanelApp.controller('mainController', function($scope, $route, $routeParams, $location, $templateCache, ngProgress) {
$templateCache.removeAll();
ngProgress.start();
$scope.$route = $route;
$scope.$location = $location;
$scope.$routeParams = $routeParams;
ngProgress.complete();
});Run Code Online (Sandbox Code Playgroud)
ui引导程序功能(如警报)应该可以工作,但它似乎不能在ngview中工作,它似乎只有在我将它添加到主基页时才能工作.有没有办法让它在ngView加载页面中工作?
Bootstrap UI功能示例:
<alert type="success">This should work</alert>
Run Code Online (Sandbox Code Playgroud)
更新: Plunker但无法让ngroute工作但基础是:http : //plnkr.co/edit/Njg16e01Ocv1iC1qzn7A?p = preview