0

Buen día,

Estoy tratando de heredar desde un componente a otro, pero cuando cargo el componente que esta heredando, el angular me bota como error todos los lugares donde he utilizado el ngModule

Nota: Estoy usando Angular 9

Este es el componente del que quiero heredar

@Component({
  selector: 'app-reportes-catalogacion',
  templateUrl: './reportes-catalogacion.component.html',
  styleUrls: ['./reportes-catalogacion.component.scss']
})
export class ReportesCatalogacionComponent implements OnInit {
prueba:string = 'sadad';
constructor(public serviceFactoryGraphicService: ServiceFactoryGraphicService, public text: textoModuloAdm, public spinner: NgxSpinnerService, public ajax: AjaxService, public encript: DycpService) {}

Modulo

import { FormsModule } from '@angular/forms';

@NgModule({
imports: [
    CommonModule,
    RouterModule.forChild(router),
    LayoutModule,
    ReactiveFormsModule
    , FormsModule
],
exports: [
    RouterModule
],
declarations: [
    ReportesCatalogacionComponent
],
providers: [
    AjaxService
    , CreateHighChartService
    , ServiceFactoryGraphicService
    , AjaxService
], 
entryComponents: [
    GraphicalAmChardComponent
  ]
})

Componente al que voy a heredar Trate de inicializar la variable para ver si funcionaba y aun así seguía generando el mismo error agregue el CommonModule y FormsModule al modulo de cada componente y aun así se seguía generando el error, también añadí el BrowserModule al modulo raíz

introducir la descripción de la imagen aquí

@Component({
  selector: 'app-indicators-default',
  templateUrl: './indicators-default.component.html',
  styleUrls: ['./indicators-default.component.scss']
})

export class IndicatorsDefaultComponent extends ReportesCatalogacionComponent implements OnInit, AfterViewInit {
  constructor(public serviceFactoryGraphicService: ServiceFactoryGraphicService, public text: textoModuloAdm, public spinner: NgxSpinnerService, public ajax: AjaxService, public encript: DycpService) {
super(serviceFactoryGraphicService, text, spinner, ajax, encript);
this.prueba = 'asdasd';
  }
}

Modulo

import { FormsModule } from '@angular/forms';

@NgModule({
imports: [
    CommonModule,
    RouterModule.forChild(router),
    LayoutModule,
    ReactiveFormsModule,
    FormsModule
],
exports: [
    RouterModule
],
declarations: [
    IndicatorsDefaultComponent
],
providers: [
    AjaxService,
    CreateHighChartService,
    ServiceFactoryGraphicService,
    AjaxService
],
entryComponents: [
    GraphicalAmChardComponent
]
})

1 respuesta 1

0

El error hace referencia a FormsModule, pero vi que lo agregaste. Podrías cambiar el orden

imports: [ ... FormsModule, ReactiveFormsModule ],

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.