简体   繁体   English

我无法将ngResource导入我的应用程序

[英]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.7angular-resource@1.6.7angular-resource@1.6.7组件对我来说确实可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何让我的ngResource接受自定义标头? - How can I get my ngResource to accept custom headers? 无法挂起FormData和ngResource - Can't get the hang of FormData and ngResource 无法从ngResource对象访问属性 - Can't access properties from a ngResource object 如何使用ngResource发布对象? - How can I post an object with ngResource? AngularJS:ngResource无法从SpringData的返回中获取响应 - Angularjs: ngResource can't get the response from SpringData's returns Angular REST客户端ngResource无法获取json - Angular REST client ngResource can't get json 我需要在angular 2应用程序中将Router和Location导入到我的app.component中,以便可以在构造函数中使用它们 - I need to import Router and Location into my app.component in my angular 2 app so I can use them in my constructor 如何使用responseError拦截器在ngResource中获取原始资源? - How can I get the original resource in ngResource with a responseError interceptor? 如何在ngResource中将默认参数设置为POST - How can i set default param in ngResource to be POST 我如何在angularjs中使用Restful。我使用ngResource但不起作用。如果我使用ngResource,则执行js文件nt - How can i use Restful in angularjs.I used ngResource but its not working .The js file nt executing if i used ngResource
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM