[英]I can't import ngResource into my App
I have an app made with Angular (angular 1.6) and NodeJS , and I can't import the angular library ngResource into my app. 我有角(角1.6),并取得的NodeJS的应用程序,我不能导入角库ngResource到我的应用程序。 These are the steps I did:
这些是我执行的步骤:
1: in command line I input npm install --save angular-resource
1:在命令行中输入
npm install --save angular-resource
2: in app.js: 2:在app.js中:
import angular from 'angular';
import ngResource from 'angular-resource';
import uiRouter from 'angular-ui-router';
import Components from './components/components';
angular.module('myApp', [
uiRouter,
Components,
ngResource
])
.component('homePage', HomeComponent)
.service('AirportsService', AirportsService)
.service('CheapFlightService', CheapFlightService)
and after doing that, I get this error in the browser: 然后,我在浏览器中收到此错误:
angular-resource.js:444 Uncaught TypeError:
angular.module(...).info is not a function angular.module(...)。info不是一个函数
Looks like you are running into compatibility problem with angularjs 1.6.x modules. 好像您遇到了angularjs 1.6.x模块的兼容性问题。
Make sure the angular and the associated modules are of same version in package.json
. 确保
package.json
的angular模块和关联的模块具有相同的版本。
With angular@1.6.7
and angular-resource@1.6.7
, the angular1 components does work fine for me. 使用
angular@1.6.7
和angular-resource@1.6.7
, angular-resource@1.6.7
组件对我来说确实可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.