import { Component , OnInit } from '@angular/core' ; import { Observable , Observer } from 'rxjs' ; import * as op from 'rxjs/operators' ; @ Component ( { selector : 'aw-basic-01' , template : `
    <h4>01 - Begin</h4>

    <div style="margin-bottom: 1rem;">
      <button type="text" (click)="sayHello()">Say hello</button>
      <button type="text" (click)="clear()">Clear</button>
    </div>

    {{message}}
  ` } ) export class Basic01Component { producer = ( o ) => { o . next ( 'Hello, good looking!' ) ; } ; observable = new Observable ( this . producer ) ; subscriber = { next : ( value ) => ( this . message = value ) } ; sayHello ( ) { this . observable . subscribe ( this . subscriber ) ; } clear ( ) { this . message = '' ; } message = '' ; }