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


(Karishma Rai) #1

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:

  • angular-resource - 1.7.5
  • @angular/cli - 7.0

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 { }

(system) #2

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.