这是一个严重愚蠢的问题,但我总是与这个斗争,所以希望有人可以提供帮助。如何查找angularjs提供程序的模块名称?
在创建我的角度应用程序时,我明白为了注入正确的提供程序,我首先需要在定义模块时包含它/需要它。
下面是一个例子 - 在这里我需要$ routeProvider,所以我包括ngRoute:
var sampleApp = angular.module('phonecatApp', ['ngRoute']);
sampleApp.config(['$routeProvider',
function ($routeProvider) {
$locationProvider.html5Mode(true);
$routeProvider.
when('/about', {
templateUrl: 'home/about',
controller: 'AddOrderController'
}).
when('/contact', {
templateUrl: 'home/contact',
controller: 'ShowOrdersController'
}).
otherwise({
redirectTo: '/about'
});
}]);
现在我还需要$ locationProvider但不知道包括哪些模块,我期待在所有的angularjs文档并尝试ngLocation,但没有运气!我的问题(不是我需要哪个模块来定位),而是如何从角度文档中找出哪个模块是我需要的任何给定的提供者?
我不能从疯狂的文档中弄明白吗?
var sampleApp = angular.module('phonecatApp', ['ngRoute', '?????']);
sampleApp.config(['$routeProvider', '$locationProvider',
function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$routeProvider.
when('/about', {
templateUrl: 'home/about',
controller: 'AddOrderController'
}).
when('/contact', {
templateUrl: 'home/contact',
controller: 'ShowOrdersController'
}).
otherwise({
redirectTo: '/about'
});
}]);