Created
January 3, 2019 08:55
-
-
Save splincode/877b16712d690f3880dffb21616910dd to your computer and use it in GitHub Desktop.
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
@Component({ | |
selector: 'app-animal', | |
template: ` | |
<ng-container *ngFor="let animals of animals$ | async"> | |
<p>{{ animal }}</p> | |
</ng-container> | |
<input #inputAnimal placeholder='Add new animal' /> | |
<button (click)="addAnimal.emit(inputAnimal.value)"> | |
Add animal | |
</button> | |
` | |
}) | |
export class CounterComponent { | |
@Select(AnimalState) | |
public animals$: Observable<string[]>; | |
@Emitter(AnimalState.addAnimal) | |
public addAnimal: Emittable<string>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment