DynamicDialog data passing issue

UI Components for Angular
Post Reply
jevylein
Posts: 1
Joined: 20 May 2020, 13:40

20 May 2020, 13:58

Hello all,

I'm trying to use the dynamicDialog with a child component and pass an id to it.

code from parent component:

Code: Select all

const ref = this.dS.open(ChildComponent, {
			data: {
				id: '1'
			},
			header: 'Choose a Car',
			width: '70%'
		});
the dialog opens, but i can't access the passed data

code childComponent:

Code: Select all

@Component({
  selector: 'app-child',
  templateUrl: './child.component.html',
  styleUrls: ['./child.component.css'],
  providers: [
	DynamicDialogRef,
	DynamicDialogConfig
  ]
})ChildComponent implements OnInit {
	id:string = '';

  constructor(
	public ref: DynamicDialogRef,
	public config: DynamicDialogConfig
  ) { }

  ngOnInit(): void {
	//id: this.config.id
	console.log(this.config);
  }
  
the console shows "{Promise: undefined}". With config.id there is only be shown 'undefined'.

what am I doing wrong?


Greets Jevylein

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests