本文整理汇总了TypeScript中@angular/forms.NgForm.resetForm方法的典型用法代码示例。如果您正苦于以下问题:TypeScript NgForm.resetForm方法的具体用法?TypeScript NgForm.resetForm怎么用?TypeScript NgForm.resetForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/forms.NgForm
的用法示例。
在下文中一共展示了NgForm.resetForm方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: hideDialog
hideDialog() {
this.dialogDisplayed = false;
if (this.editing) {
this.refreshOnEdit(this.contact, this.selectedContact) // Refresh dataTable after company update
}
this.contactForm.resetForm();
}
示例2: navigateToSelectedIndex
private navigateToSelectedIndex() {
const optionalParams = {
index: this.state.getIndex()
};
this.stopRestTimer();
this.alarm.pause();
this.workoutForm.resetForm();
this.router.navigate(['workouts', this.workout.workoutId, optionalParams]);
}
示例3: onSubmit
onSubmit(form: NgForm) {
// Create
var image = form.value.image;
if(image == null || image.length < 20 || image.includes('instagram') || !(image.includes("http") && image.includes("com")) ){
form.value.image = "https://i1.wp.com/eddieandsylviarobertson.com/wp-content/uploads/2015/09/Default-Icon-icon.png";
}
if(form.value.author == null){
form.value.author = "睡前要吃饱,否则会做饿梦的";
}
this.messageService.addMessage(new Message(
form.value.content,
form.value.author,
form.value.image,
(new Date()).toLocaleString() ))
.subscribe(
data => console.log(data),
error => console.error(error)
);
form.resetForm();
}
示例4: onSubmit
onSubmit(form: NgForm) {
if(this.message) {
//Edit
this.message.content = form.value.content;
this.messageService.updateMessage(this.message)
.subscribe(
result => console.log(result)
);
this.message = null;
}else{
//console.log(form);
//console.log(value);
const message = new Message(form.value.content, 'Srivatsa');
this.messageService.addMessage(message)
.subscribe(
data => console.log(data),
error => console.log(error)
);
}
form.resetForm();
}
示例5: onSubmit
// Incoming value of type String
onSubmit(form: NgForm) {
if (this.message) {
// Edit
this.message.content = form.value.content;
this.messageService.updateMessage(this.message)
.subscribe(
result => console.log(result)
);
this.message = null;
} else {
// Creating
const message = new Message(form.value.content, "John");
this.messageService.addMessage(message)
// Send the request
.subscribe(
data => console.log(data),
error => console.error(error)
);
}
// Angular's method
form.resetForm();
}
示例6: onClear
onClear(form: NgForm) {
// Clear
this.message = null;
form.resetForm();
}
示例7: setTimeout
setTimeout(() => {
this.form.resetForm();
},100);