Commit 87da2d5f authored by 李彥志's avatar 李彥志

update 題三

parent 3b42d864
<p style="color:green">題三</p>
<!-- 圖片無法顯示QQ -->
寬度 : <input type="number" min="1" step="5" ><br>
高度 : <input type="number" min="1" step="5"><br>
<img src ="imageUrl">
<img [src]=" imageUrl ">
<img bind-src="imageUrl ">
WidthLength : <input type="number" min="1" step="5" [(ngModel)]="widthLength" (change)="showPic()" ><br>
HeightLength : <input type="number" min="1" step="5" [(ngModel)]="heightLength" (change)="showPic()"><br>
<img [src]='imageUrl '/>
<router-outlet></router-outlet>
......@@ -9,19 +9,21 @@ export class P3Component implements OnInit {
widthLength = '1024';
heightLength = '768';
imageUrl = 'http://lorempixel.com/{{widthLength}}/{{heightLength}}/';
imageUrl = null;
ngOnInit() {
this.showPic();
}
showPic() {
if (this.widthLength !== null && this.heightLength !== null &&
this.widthLength !== undefined && this.heightLength !== undefined) {
this.imageUrl = 'http://lorempixel.com/' + this.widthLength + '/' + this.heightLength + '/';
this.imageUrl = 'https://lorempixel.com/' + this.widthLength + '/' + this.heightLength + '/';
} else {
alert('長度或高度不得為空!');
alert('null');
}
}
constructor() { }
ngOnInit() { }
}
......@@ -49,7 +49,7 @@ export class P4Component implements OnInit {
if (
this.value2 !== Number
) {
alert('只能輸入數字');
alert('欄位只能輸入英文兩碼 + 數字三碼');
} else {
alert('輸入正確');
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment