【发布时间】:2018-06-13 11:46:25
【问题描述】:
我想在文本框的输入更改时调用类型脚本函数,它对我有用。但它会在每次更改时调用,我想在文本框中的最小字符数为 5 时调用。
export class StudentMaintenanceComponent implements OnInit {
@Component({
selector: 'app-student-management',
template: `<input placeholder="" class="form-control" type="text" [maxlength]="5" (input)="SearchData($event.target.value)">`,
styleUrls: ['./app-student-management.css']
})
SearchData(_no: string) { // should be called when minimum no of character are 5 in the text field.
console.log(_no);
}
}
【问题讨论】:
-
你可以看看stackoverflow.com/questions/45096161/…。我认为这是同样的问题。
标签: typescript angular2-template angular2-components