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