我想重用链接。如何在配置函数中使用 $routeProvider 和自定义模块?
angular.module('urls', []).
factory('$urls', function (
$location
) {
var $urls = {};
$urls.login = function () {
var url = '/login';
return url;
}
return $urls;
});
angular.module('app', ['urls']).
config(function ($routeProvider, $urls) {
$routeProvider.
when($urls.login(), { controller: PageCtrl, templateUrl: 'tem.html' }).
otherwise({ redirectTo: $urls.login() });
});