Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import { Component,Input,OnInit } from '@angular/core';
@Component({
selector: 'appchild',
template: `<h2>Hi {{message}}</h2>`
})
export class ChildComponent implements OnInit{
_message: string;
constructor(){
}
ngOnInit(){
}
@Input()
set message(message : string ){
this._message = (message && message.trim()) || "I am default message";
}
get message(){
return this._message;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment