Page 1 of 1

dialogService.open

Posted: 09 Jan 2019, 04:26
by suetam.schneider
Boa noite,

Estou com um problema ao usar dialogService.open(MeuComponente, config) . O DynamicDialogConfig recuperado no construtor do componente da chamada retorna vazio.


CHAMADA:

Code: Select all

show() {
    const ref = this.dialogService.open(GridDetailBancoHorasComponent, { 
      data : {cdFuncionario: this.selectedColaborador.cdFuncionario},
      header : 'Detalhes',
      width : '70%',
      footer : 'Footer',
      transitionOptions: '50ms cubic-bezier(0.25, 0.8, 0.25, 1)'
    });
  }
COMPONENTE DA CHAMADA:

Code: Select all

import { Component, OnInit, Input } from '@angular/core';
import { DynamicDialogRef, DynamicDialogConfig } from 'primeng/api';
import { JornadaService } from 'src/app/services/jornada.service';
import { Jornada } from 'src/app/core/model/jornada';

@Component({
  selector: 'app-grid-detail-banco-horas',
  templateUrl: './grid-detail-banco-horas.component.html',
  styleUrls: ['./grid-detail-banco-horas.component.scss'],
  providers: [DynamicDialogRef, DynamicDialogConfig]
})
export class GridDetailBancoHorasComponent implements OnInit {

  jornadas: Jornada[];
  cols: any[];
  constructor(private jornadaService: JornadaService, private ref: DynamicDialogRef, private config: DynamicDialogConfig) { }

  ngOnInit() {
    console.log(this.ref, this.config);

    /*this.jornadaService.getJornadasByReferencia(this.config.mesRef, this.config.codFuncionario).then(jornadas => this.jornadas = jornadas);*/

    this.cols = [
      { field: 'id', header: 'ID' },
      { field: 'cdFuncionario', header: 'COD' },
      { field: 'idPedido', header: 'ID PED' },
      { field: 'tipoId', header: 'TIPO ID' },
      { field: 'inicio', header: 'INICIO' },
      { field: 'fim', header: 'FIM' },
      { field: 'descontoId', header: 'DESCONTO' },
      { field: 'tbRhMesReferenciaId', header: 'MES REF ID' }
    ]
  }
}
RETORNO NO CONSOLE:
Image

REFERENCIA:
https://www.primefaces.org/primeng/#/dynamicdialog

Re: dialogService.open

Posted: 09 Jan 2019, 19:04
by suetam.schneider
Resolvido!

Eu estava especificando os providers direto no component. Passei a especificar no modulo do componente e deu certo!!!

Code: Select all

providers: [DynamicDialogRef, DynamicDialogConfig]

Re: dialogService.open

Posted: 16 Jan 2019, 09:35
by yigitfindikli
Me alegra oír eso.