diff --git a/src/app/app.component.html b/src/app/app.component.html index 7de4498..6438df3 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,2 +1,9 @@ -查詢條件: - +
+
帳號:
+
密碼:
+
+ + +
+
+
{{ form.value | json }}
diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 47a1d79..9834cfe 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { FormControl } from '@angular/forms'; +import { FormControl, FormGroup } from '@angular/forms'; @Component({ @@ -8,9 +8,9 @@ import { FormControl } from '@angular/forms'; styleUrls: ['./app.component.css'], }) export class AppComponent { - readonly condition = new FormControl(); + readonly form = new FormGroup({ + id:new FormControl(), + password: new FormControl(), + }); - onSearch(): void{ - console.log(`查詢條件:${this.condition.value}`); - } }