Created
July 27, 2017 17:53
-
-
Save slmyers/cc54febec8ad13ca0c4c6efcc108f6e4 to your computer and use it in GitHub Desktop.
my-example-angular-component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; | |
@Component({ | |
selector: 'my-component', | |
styleUrls: './my-component.css', | |
template: ` | |
<button [style.color]="color" (click)="bar.emit('bar')"> {{ foo }} </button> | |
` | |
}) | |
export class MyComponent implements OnInit{ | |
@Input() foo: string; | |
@Ouptut() bar = new EventEmitter(); | |
color; | |
ngOnInit() { | |
this.color = 'darkorange'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment