Skip to content

Instantly share code, notes, and snippets.

@slmyers
Created July 27, 2017 17:53
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 slmyers/cc54febec8ad13ca0c4c6efcc108f6e4 to your computer and use it in GitHub Desktop.
Save slmyers/cc54febec8ad13ca0c4c6efcc108f6e4 to your computer and use it in GitHub Desktop.
my-example-angular-component
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