|
|
@ -1,5 +1,5 @@ |
|
|
|
import { Component } from '@angular/core'; |
|
|
|
import { NgModel } from '@angular/forms'; |
|
|
|
import { NgForm, NgModel } from '@angular/forms'; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'my-app', |
|
|
@ -7,10 +7,7 @@ import { NgModel } from '@angular/forms'; |
|
|
|
styleUrls: ['./app.component.css'], |
|
|
|
}) |
|
|
|
export class AppComponent { |
|
|
|
|
|
|
|
result=''; |
|
|
|
onSearch(condition:NgModel): void { |
|
|
|
console.log(`查詢條件:${condition.value}`); |
|
|
|
this.result=condition.value; |
|
|
|
onSubmit(form:NgForm):void{ |
|
|
|
console.log('表單資料:', form.value); |
|
|
|
} |
|
|
|
} |