Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I pass custom data to CustomComponent on BodyOutputType.Component #160

Closed
nancybarraza opened this issue May 3, 2018 · 2 comments

Comments

@nancybarraza
Copy link

nancybarraza commented May 3, 2018

Hi @Stabzs ,

I need be able to send custom data to the CustomComponent as @Input or similar to be able to display custom messages and custom templates.
I found this #112 ticket, but the shared plunker is not working anymore.

Here is my code to call the Toast.

let toast: Toast =  {
	type: 'error',
	body: ToasterBodyComponent,
	bodyOutputType: BodyOutputType.Component,
	data:  {
		message: 'Hello World', 
		hasIcon: true, 
		saveButtonText: 'Save', 
		cancelButtonText: 'Dismiss'
	}
};
this._toaster.pop(toast);

And in my ToasterBodyComponent here is the HTML:

<div class="toast-wrapper"> 
    <div class="left">
        <i class="k-icon" 
        [class.k-i-close-circle.k-i-x-circle]="error" 
        [class.k-i-check-circle.k-i-checkmark-circle]="success" *ngIf="hasIcon"></i>
        {{message}} 
    </div>

    <div class="toast-actions right">
        <button mat-button class="left" (click)="onCancelButtonClick($event)">{{cancelButtonText}}</button>        
        <button mat-button color="primary" class="left" (click)="onSaveButtonClick($event)">{{saveButtonText}}</button>
    </div>
</div>

I know that I am missing something, but when I add the public toast: Toast it is undefined;
Any help would be appreciated.

@nancybarraza
Copy link
Author

I found the solution, thanks anyway I will close the ticket.

@max-SS
Copy link

max-SS commented Jul 19, 2018

could you share the solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants