Angularjs 可从所有模块访问的常数

Angularjs 可从所有模块访问的常数,angularjs,Angularjs,我想有一个常数,可以从我的其他模块访问。 我试过下面的方法,但有例外。 我应该如何修改代码使其工作 angular.module('starter', ['starter.Authentication']) .constant('baseUrl', 'http://myUrl/api/'); angular.module('starter.Authentication', ['baseUrl']) .factory('AuthenticationService', ['baseUrl',

我想有一个常数,可以从我的其他模块访问。 我试过下面的方法,但有例外。 我应该如何修改代码使其工作

angular.module('starter', ['starter.Authentication'])
.constant('baseUrl', 'http://myUrl/api/');

angular.module('starter.Authentication', ['baseUrl'])

.factory('AuthenticationService', 
['baseUrl',
function (baseUrl) {
    var service = {};
    return service;
};

Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to:
Error: [$injector:modulerr] Failed to instantiate module starter.Authentication due to:
Error: [$injector:modulerr] Failed to instantiate module baseUrl due to:
Error: [$injector:nomod] Module 'baseUrl' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
更改:

angular.module('starter.Authentication', ['baseUrl'])
致:


这是因为
starter
是一个保存
baseUrl
常量的模块。

谢谢,我为常量创建了其他模块,现在它可以工作了。
angular.module('starter.Authentication', ['starter'])