本文整理汇总了TypeScript中@angular/forms.FormGroup.reset方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FormGroup.reset方法的具体用法?TypeScript FormGroup.reset怎么用?TypeScript FormGroup.reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/forms.FormGroup
的用法示例。
在下文中一共展示了FormGroup.reset方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: cacel
cacel() {
this.formEmergency.reset({
driver: '',
paramedic: '',
ambulance: ''
});
this.formPatient.reset();
}
示例2: if
}).subscribe((d) => {
if(d == 1) {
this._fM.show('<h5>Thank you for your subscription.!</h5><p>This newsletter is generally sent out a weekly basis.</p>', { cssClass: 'alert-success', timeout: 6000 });
this.newsLetterForm.reset();
} else if(d == 2) {
this._fM.show('Your are already subscribe!', { cssClass: 'alert-info', timeout: 3000 });
this.newsLetterForm.reset();
}
if(d == 0) {
this._fM.show('Error please try again!', { cssClass: 'alert-danger', timeout: 3000 });
}
});
示例3: saveEmergency
saveEmergency() {
if (this.formEmergency.valid) {
if (this.patients.length > 0) {
const emergency = {
date: this.formEmergency.get('date').value,
type_emergency: this.formEmergency.get('category').value,
driver: this.driverSelected,
ambulance: this.ambulanceSelected,
paramedic: this.paramedicsSelected,
patient: this.patients,
location: {
type: 'Point',
coordinates: this.positions
}
};
this.formEmergency.reset({
driver: '',
ambulance: '',
paramedics: ''
});
this._emergencyService.save(emergency).subscribe(
(res) => {
console.log(res.json());
},
(error) => {
console.log(error.json());
}
);
}else{
this._toast.info('Debe ingresar al menos un paciente', 'Emergencias!');
}
}else{
this._toast.info('Todos los campos marcados con * son obligatorios', 'Emergencias!');
}
}
示例4: resetForm
resetForm() {
this.blogForm.reset({
title: '',
urlTitle: '',
contents: ''
});
}
示例5: saveAmbulance
saveAmbulance() {
if (this.formAmbulance.valid) {
const ambulance = {
car: this.formAmbulance.get('car').value,
car_plate: this.formAmbulance.get('car_plate').value,
type_ambulance: this.formAmbulance.get('type_ambulance').value,
available: this.formAmbulance.get('available').value
};
this.formAmbulance.reset({
car: '',
car_plate: '',
type_ambulance: '',
available: ''
});
this._ambulanceService.save(ambulance).subscribe(
(res) => {
console.log(res.json());
},
(error) => {
console.log(error.json());
}
);
}else {
this._toast.info('Todos los campos marcados con * son obligatorios', 'Ambulancias!');
}
}
示例6: resetForm
resetForm() {
this.templateForm.reset({
name: '',
content: '',
comment: ''
});
}
示例7: onConfirmLink
private onConfirmLink(){
// Ensure that the form is valid
if (this.uploadLinkForm.valid){
// Obtain the link from the form
let link = this.uploadLinkForm.controls['link'].value;
let origin = 'youtube-play';
// Set the origin to vimeo if the url is a vimeo link
if (link.includes('vimeo')){
origin = 'vimeo';
}
// Or to soundcloud if it's from soundcloud
if (link.includes('soundcloud')){
origin = 'soundcloud';
}
// Populate pending uploads data list with link and origin
this.pendingUploadsDataSet.push({
'id': UUID.UUID(),
'link': link,
'origin': origin,
'isNameValid': true,
'isUploading': false
});
// Clear the video upload link forum
this.uploadLinkForm.reset();
}
}
示例8: update
update() {
const data = {
emergency: {},
error: {},
valid: false
};
if (this.formEmergency.valid) {
const emergency = {
_id: this.data._id,
date: this.formEmergency.get('date').value,
type_emergency: this.formEmergency.get('category').value,
driver: this.driverSelected,
ambulance: this.ambulanceSelected,
paramedic: this.paramedicsSelected,
patient: this.patients,
location: this.data.location
};
this.formEmergency.reset({
driver: '',
ambulance: '',
paramedics: ''
});
data.emergency = emergency;
data.valid = true;
this.dialogRef.close(data);
}else {
this.errorMessage = 'Los campos marcados con * son obligatorios';
}
}
示例9: update
update() {
const data = {
ambulance: {},
error: {},
valid: false
};
debugger
if (this.formAmbulance.valid) {
const ambulance = {
_id: this.data._id,
car: this.formAmbulance.get('car').value,
car_plate: this.formAmbulance.get('car_plate').value,
type_ambulance: this.formAmbulance.get('type_ambulance').value,
available: this.formAmbulance.get('available').value
};
this.formAmbulance.reset({
car: '',
car_plate: '',
type_ambulance: '',
available: ''
});
data.ambulance = ambulance;
data.valid = true;
this.dialogRef.close(data);
}else {
this.errorMessage = 'Los campos marcados con * son obligatorios';
}
}
示例10: handlePostResponse
protected handlePostResponse(res: Response) {
console.log('**** response from password POST ***');
console.log(JSON.stringify(res));
console.log('***************************************');
this.formGroup.reset();
this.accountSvc.doGetRequest("/credentials/password", (res: Response) => this.handleGetResponse(res));
}