p4.component.ts 537 Bytes
Newer Older
李彥志's avatar
李彥志 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-p4',
  templateUrl: './p4.component.html',
  styleUrls: ['./p4.component.css']
})
export class P4Component implements OnInit {

  number = '';
  value2: any;

  addNumber(inputRef: HTMLInputElement): void {
    console.log(inputRef.value);
    inputRef.value = '';

    inputRef.value = this.value2;

    if (
      this.value2 = 0
    ) {
      alert('good');
    } else {
    alert('請輸入0');
    }
  }



  constructor() { }

  ngOnInit() {
  }

}