File

libs/fruit-basket/src/counter-display/counter-display.component.ts

Metadata

selector counter-display
templateUrl ./counter-display.component.html

Index

Inputs
Outputs

Inputs

counter

Type: number

label

Type: string

Outputs

pick $event type: EventEmitter
import { Component, Input, Output, EventEmitter } from '@angular/core';

@Component({
  selector: 'counter-display',
  templateUrl: './counter-display.component.html'
})
export class CounterDisplayComponent {
  @Input() label: string;
  @Input() counter: number;
  @Output() pick = new EventEmitter<number>();
}
<div class="card">
  <div class="card-content">
    <div class="card-title">{{label}}</div>
    Current total: {{ counter }}
  </div>
  <div class="card-action">
    <button class="btn" (click)="pick.emit(1)">Pick</button>
    <button class="btn" (click)="pick.emit(3)" *ngIf="label === 'Apples'">Pick 3</button>
  </div>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""