I can't import ngResource into my App

301 Views Asked by At

I have an app made with Angular (angular 1.6) and NodeJS, and I can't import the angular library ngResource into my app. These are the steps I did:

1: in command line I input npm install --save angular-resource

2: in 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

1

There are 1 best solutions below

0
Rakesh Kumar Cherukuri On

Looks like you are running into compatibility problem with angularjs 1.6.x modules.

Make sure the angular and the associated modules are of same version in package.json.

With [email protected] and [email protected], the angular1 components does work fine for me.