0
我在模块中配置了我的路由,它的工作很好,但我也试图添加一个加载指示器,它将拦截任何http请求并加载加载映像,但它是不工作。这里是我的模块:Angularjs - 在同一模块中的两个配置功能
var myApp = angular.module('myApp', ['ngRoute', 'angular-loading-bar', 'ngAnimate', 'ui.bootstrap']);
myApp.config(["$routeProvider", "$locationProvider",
function ($routeProvider, $locationProvider) {
$routeProvider
.when("/", {
templateUrl: "/pages/home.html"
})
.when("/currency", {
templateUrl: "/app/series/currencySearch.html",
controller: "currencyController"
})
.when("/others", {
templateUrl: "/app/series/genericSearch.html",
controller: "genericController"
})
.otherwise({
redirectTo: "/"
});
$locationProvider.html5Mode(false);
}]);
myApp.config(['cfpLoadingBarProvider', function (cfpLoadingBarProvider) {
cfpLoadingBarProvider.spinnerTemplate = '<div style="margin:20% 0 0 50%;"><span class="fa fa-spinner fa-pulse fa-3x"></div>';
}]);
它可以使用两个配置功能,这种方式?
非常感谢!
为什么你就不能初始化加载器在运行,而不是块配置.. –
,只要你想你肯定能有尽可能多的'.config'功能。也许你应该描述实际问题 – Phil