-1

I am trying to use $resource object 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.

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

UPDATE

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 { }
inspiringmyself
  • 590
  • 1
  • 11
  • 29

1 Answers1

1

I think that 'angular-resource' package is for angularJS https://www.npmjs.com/package/angular-resource .

If you wanna use angular resource for angular 2+, you can use angular-material instead of angular-resource.it includes most of components we often use. https://material.angular.io/components/categories

npm install --save @angular/material @angular/cdk @angular/animations

Try this steps: https://material.angular.io/guide/getting-started

Isanka Thalagala
  • 1,625
  • 3
  • 16
  • 32