Skip to content

Instantly share code, notes, and snippets.

@wKoza
Created October 25, 2016 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wKoza/59342d7af0aa7052f4ca68b6c3409b8c to your computer and use it in GitHub Desktop.
Save wKoza/59342d7af0aa7052f4ca68b6c3409b8c to your computer and use it in GitHub Desktop.
import { Component, Input } from '@angular/core';
@Component({
selector: 'name-child',
template: `
<h3>"{{name}}"</h3>
`
})
export class NameChildComponent {
_name: string = '<no name set>';
@Input()
set name(name: string) {
this._name = (name && name.trim()) || '<no name set>';
}
get name() { return this._name; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment