本文整理汇总了TypeScript中@angular/forms.NgForm类的典型用法代码示例。如果您正苦于以下问题:TypeScript NgForm类的具体用法?TypeScript NgForm怎么用?TypeScript NgForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NgForm类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: limpiarFormulario
limpiarFormulario(form?: NgForm){
//Si el formulario que le mando existe
if(form){
form.reset();
this.userService.selectedUser= new User();
}
}
示例2: resetForm
resetForm(form?: NgForm) {
if (form != null) {
form.reset();
this.teamService.selectedTeam = {
$key: null,
title: '',
description: '',
};
}
}
示例3: addNewComment
addNewComment(form : NgForm){
console.log(form);
this.newComment = {
stars : form.value.stars,
author : form.value.author,
body : form.value.body
}
console.log("Comments " + this.newComment);
this.comments.push(this.newComment);
form.reset();
}
示例4: resetForm
resetForm(userForm?: NgForm){
if(userForm){
userForm.reset();
this.userService.selectedUser = {
$key: null,
name: '',
mail: ''
};
}
}
示例5: resetSchoolForm
resetSchoolForm(schoolForm?: NgForm) {
if (this.schoolService.selectedSchool.$key == null) {
if (schoolForm != null)
schoolForm.reset();
this.schoolService.selectedSchool = {
$key: null,
name: '',
EMIS: 0,
tehsil: '',
district: '',
postOffice: ''
}
if (this.schoolService.selectedSchool.$key != null)
alert('edit');
}
}
示例6: hideDialog
hideDialog() {
this.dialogDisplayed = false;
if (this.editing) {
this.refreshOnEdit(this.contact, this.selectedContact) // Refresh dataTable after company update
}
this.contactForm.resetForm();
}
示例7: reply
/**
* Reply
*/
reply(event): void
{
event.preventDefault();
if ( !this._replyForm.form.value.message )
{
return;
}
// Message
const message = {
who : this.user.id,
message: this._replyForm.form.value.message,
time : new Date().toISOString()
};
// Add the message to the chat
this.chat.dialog.push(message);
// Reset the reply form
this._replyForm.reset();
// Update the server
this._chatPanelService.updateChat(this.chat.id, this.chat.dialog).then(response => {
// Prepare the chat for the replies
this._prepareChatForReplies();
});
}
示例8: changeForm
changeForm() {
this.singUPForm.setValue({
userInformation: {
userName: 'John_Doe',
email: 'john@doe.com',
},
password: 'somePass',
showPassword: 'true'
});
}
示例9: 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]);
}
示例10:
this._taskService.addDish(newDish.value).subscribe(data => {
if (data['Status'] == true){
console.log(data['Status'])
console.log("successfully added", data)
newDish.reset();
this.showDish();
} else {
console.log(data)
this.msg = data['Error']
}
})