p3.component.ts 697 Bytes
Newer Older
李彥志's avatar
李彥志 committed
1 2 3 4 5 6 7 8 9
import { Component, OnInit } from '@angular/core';

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

李彥志's avatar
李彥志 committed
10 11 12
  widthLength = '1024';
  heightLength = '768';
  imageUrl = 'http://lorempixel.com//{{widthLength}}/{{heightLength}}/';
李彥志's avatar
李彥志 committed
13

李彥志's avatar
李彥志 committed
14 15 16 17 18 19 20
  showPic() {
    if (this.widthLength !== null && this.heightLength !== null &&
      this.widthLength !== undefined && this.heightLength !== undefined) {
      this.imageUrl = "http://lorempixel.com/" + this.widthLength + "/" + this.heightLength + "/";
    } else {
      alert("長度或高度不得為空!");
    }
李彥志's avatar
李彥志 committed
21 22
  }

李彥志's avatar
李彥志 committed
23 24 25 26
  constructor() { }

  ngOnInit() { }

李彥志's avatar
李彥志 committed
27
}