I installed ng2-img-max for the purpose of resizing images. I want each submitted image to be resized to a predefined width and length. I see that most people use ng2-img-max when developing with 2/4 angular. I tried using this lib and then faced the following error:
Error: Uncaught (in promise): Error: No provider for Ng2PicaService
This error informs that the service name needs to be placed on the providers, the problem is that in my project I did not create any service with that name, I am guiding myself through this tutorial below;
Resizing Images in the Browser in Angular With ng2-img-max
I have created a module to store all the services related to the implementation of the image resizer as you can see below;
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ImgMaxPXSizeService } from './img-maxpx-size.service';
import { ImgMaxSizeService } from './img-max-size.service';
import { Ng2ImgMaxService } from './ng2-img-max.service';
import { ImgExifService } from './img-exif.service';
import { Ng2PicaService } from '../../../node_modules/ng2-pica';
@NgModule({
imports: [
CommonModule
],
declarations: [],
providers: [
ImgMaxPXSizeService,
ImgExifService,
ImgMaxSizeService,
Ng2ImgMaxService
]
})
export class ImgMaxModule { }
//https://github.com/bergben/ng2-img-max
And the module I posted in the app.module.ts
As you can see below;
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpModule,
RouterModule,
SharedModule,
RestaurantModule,
AdminModule,
ImgMaxModule,// >>>>>>> modulo de imagens
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
How could I circumvent this problem?
I think that only people who have already tampered with this lib will be able to help me.
This is my complete project in the github repository.