无法使用 Angular-fullstack 生成器的最新版本使用服务
Unable to use service using last release of Angular-fullstack generator
我刚刚将我的 Angular-fullstack 生成器从 3.0.0-rc9 更新到 3.7.0。
我创建了一个新项目:
yo angular-fullstack myProject
我在创建新服务时遇到了一些麻烦:
yo angular-fullstack:service myService
创建后,我的浏览器出现以下错误:(这是我的问题)
angular.js:68
Uncaught Error: [$injector:nomod] Module 'myProjectApp.myService' 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.
在 index.html 中正确注入:
<script src="app/service/myService/myService.service.js"></script>
这里是myService.service.js的内容:(以防万一^^)
'use strict';
angular.module('myProjectApp.myService')
.service('myService', function () {
// AngularJS will instantiate a singleton by calling "new" on this function
});
我不知道它是否可能来自于此:(在 bower 安装期间)
Unable to find a suitable version for angular, please choose one by typing one of the numbers below:
1) angular#~1.2.0 which resolved to 1.2.29 and is required by ngSweetAlert#1.1.0
2) angular#~1.2.9 which resolved to 1.2.29 and is required by ng-ckeditor#0.2.1
3) angular#>=1.4.0 which resolved to 1.5.5 and is required by angular-bootstrap#1.1.2
4) angular#^1.2.0 which resolved to 1.5.5 and is required by ngSmoothScroll#2.0.0
5) angular#1.5.5 which resolved to 1.5.5 and is required by angular-animate#1.5.5
6) angular#~1.5.0 which resolved to 1.5.5 and is required by webapp2
7) angular#^1.2.6 which resolved to 1.5.5 and is required by angular-socket-io#0.7.0
8) angular#^1.0.8 which resolved to 1.5.5 and is required by angular-ui-router#0.2.18
9) angular#>=1.2.0 <2.0.0 which resolved to 1.5.5 and is required by angular-validation-match#1.5.2
10) angular#* which resolved to 1.5.5 and is required by angular-clipboard#1.4.2
Prefix the choice with ! to persist it to bower.json
? Answer 5
如何解决?谢谢!
根据 this,我删除了 .myService 现在给我这个:
'use strict';
angular.module('myProjectApp')
.service('myService', function () {
// AngularJS will instantiate a singleton by calling "new" on this function
});
现在可以使用了!
我刚刚将我的 Angular-fullstack 生成器从 3.0.0-rc9 更新到 3.7.0。
我创建了一个新项目:
yo angular-fullstack myProject
我在创建新服务时遇到了一些麻烦:
yo angular-fullstack:service myService
创建后,我的浏览器出现以下错误:(这是我的问题)
angular.js:68
Uncaught Error: [$injector:nomod] Module 'myProjectApp.myService' 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.
在 index.html 中正确注入:
<script src="app/service/myService/myService.service.js"></script>
这里是myService.service.js的内容:(以防万一^^)
'use strict';
angular.module('myProjectApp.myService')
.service('myService', function () {
// AngularJS will instantiate a singleton by calling "new" on this function
});
我不知道它是否可能来自于此:(在 bower 安装期间)
Unable to find a suitable version for angular, please choose one by typing one of the numbers below:
1) angular#~1.2.0 which resolved to 1.2.29 and is required by ngSweetAlert#1.1.0
2) angular#~1.2.9 which resolved to 1.2.29 and is required by ng-ckeditor#0.2.1
3) angular#>=1.4.0 which resolved to 1.5.5 and is required by angular-bootstrap#1.1.2
4) angular#^1.2.0 which resolved to 1.5.5 and is required by ngSmoothScroll#2.0.0
5) angular#1.5.5 which resolved to 1.5.5 and is required by angular-animate#1.5.5
6) angular#~1.5.0 which resolved to 1.5.5 and is required by webapp2
7) angular#^1.2.6 which resolved to 1.5.5 and is required by angular-socket-io#0.7.0
8) angular#^1.0.8 which resolved to 1.5.5 and is required by angular-ui-router#0.2.18
9) angular#>=1.2.0 <2.0.0 which resolved to 1.5.5 and is required by angular-validation-match#1.5.2
10) angular#* which resolved to 1.5.5 and is required by angular-clipboard#1.4.2
Prefix the choice with ! to persist it to bower.json
? Answer 5
如何解决?谢谢!
根据 this,我删除了 .myService 现在给我这个:
'use strict';
angular.module('myProjectApp')
.service('myService', function () {
// AngularJS will instantiate a singleton by calling "new" on this function
});
现在可以使用了!