npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

angular - After installing angular-resource and importing in @NgModule throws $$minErr undefined error

I am trying to use $resource in my project. These are the steps I followed to install and import the package.

  1. Installed angular-resource using npm - npm install angular-resource
  2. Added ngResource as dependency in @NgModule - require(‘angular-resource’)

Versions:

Compiles fine. When running, throws the following error

Cannot read property ‘$$minErr’ of undefined

It’s complaining that it can’t find angular.js file so unable to find that property. I created my project with Angular CLI and never needed to install angular separately and never used script tag for angular.js.

I am assuming CLI stores angular in a different folder structure? What am I missing here?

Updating with app.module.ts code

declare var require: any;  
import { BrowserModule } from '@angular/platform-browser';  
import { NgModule } from '@angular/core';  
import { AppComponent } from './app.component';    
import { ActivityListComponent } from './activities/activity-list.component';   

@NgModule({    

declarations: [
AppComponent,
ActivityListComponent],  

imports: [
BrowserModule,
require('angular-resource')],    

providers: [],
bootstrap: [AppComponent]})    

export class AppModule { }