Angularjs + Requirejs供应商错误



我是angularjs和requirejs的新手,我遇到了下一个错误。我看到了几个类似的问题,但仍然不能摆脱这个错误。

Error: [$injector:unpr] Unknown provider: versionProvider <- version <- appVersionDirective
我app.js

:

 define([
     'angular',
     './controllers/index',
     './directives/index',
     './filters/index',
     './services/index'
 ], function (ng) {
     'use strict';
     return ng.module('app', [
         'ngRoute',
         'app.controllers',
         'app.filters',
         'app.directives',
         'app.services'
     ]);
});

指令/index.js:

define([
    './myDirective'
], function () {});

指令/module.js:

define(['angular', '../services/module'], function (ng, services) 
{
    'use strict';
    return ng.module('app.directives', ['app.services']);
});

指令/myDirective.js:

define(['./module'], function (directives) 
{
    'use strict';
    directives.directive('appVersion', ['version', function (version) 
    {
            return function(scope, elm, attrs) 
            {
                elm.text(version);
            };
        }]);
});

代码有错误吗?还是我的方法错了?如果有人能帮忙,我会很感激。

就像miqid说的,我在我的服务中搞砸了版本定义。

现在看起来是这样的:

services.value('version', '0.2');

最新更新