I am trying to use $resource object in my project. These are the steps I followed to install and import the package.
- Installed angular-resource using npm - npm install angular-resource
- 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 { }