angularangular2-material

Angular 2: Set @Input variables in Dialog Component


As per the latest Angular2-Material docs of Dialog Component . There is no description on how to pass values to dialog component. Is it achievable via component interaction mechanisms? Apart from using a service.

In normal component interaction we had seen that we can pass the values this way:

<app-child [data]="some_data"></app-child>

@Input data:string;

Solution

  • Found the Answer in a comment discussion:

    this.dialogRef.componentInstance.param1 = "test value";

    See Also: Working example of Angular 2.0 Material MdDialog with Angular 2.0

    plnkr.co/edit/n185tQbEHg1xGlNCAdxQ?p=preview