Skip to content

Instantly share code, notes, and snippets.

@duarte171183
Created September 28, 2019 08:40
Show Gist options
  • Save duarte171183/4b5f718f919dfa847b8ac56217c2aaaa to your computer and use it in GitHub Desktop.
Save duarte171183/4b5f718f919dfa847b8ac56217c2aaaa to your computer and use it in GitHub Desktop.
import { Component, OnInit, EventEmitter, Output } from '@angular/core';
import { DataService } from 'src/app/services/data.service';
import * as M from 'materialize-css';
@Component({
selector: 'app-message',
templateUrl: './message.component.html',
styleUrls: ['./message.component.css']
})
export class MessageComponent implements OnInit {
message: String ='';
constructor(private data: DataService) { }
ngOnInit() {
this.data.currentMessage.subscribe(message => this.message = message);
if(this.message.length){
M.toast({html: this.message, classes: 'rounded'});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment