dialogService.open

UI Components for Angular
Post Reply
suetam.schneider
Posts: 2
Joined: 09 Jan 2019, 04:10

09 Jan 2019, 04:26

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

suetam.schneider
Posts: 2
Joined: 09 Jan 2019, 04:10

09 Jan 2019, 19:04

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]

yigitfindikli
Posts: 352
Joined: 08 Aug 2018, 14:09

16 Jan 2019, 09:35

Me alegra oír eso.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest