本文整理汇总了TypeScript中@angular/forms.FormGroup.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FormGroup.get方法的具体用法?TypeScript FormGroup.get怎么用?TypeScript FormGroup.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/forms.FormGroup
的用法示例。
在下文中一共展示了FormGroup.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: submit
submit() {
const body = JSON.stringify({
newPassword: this.updatePassForm.get('passwords').get('newPassword').value,
id_user: this.id_user
});
this.recoverPasswordService.setPass(body, this.id_user, this.token).subscribe(
data => {
// console.log(data);
if (data.hasOwnProperty('success')) {
this.snackBar.open(data.msg, data.success ? 'Successfull' : 'Error', {
duration: 5000,
});
if (data.success) {
this.router.navigate(['']);
}
}
},
err => console.log(err),
);
}
示例2: resetPassword
/**
* Do the password reset.
*/
public async resetPassword(): Promise<void> {
if (this.resetPasswordForm.invalid) {
return;
}
try {
await this.http.post<void>(environment.urlPrefix + '/users/reset-password/', {
email: this.resetPasswordForm.get('email').value
});
// TODO: Does we get a response for displaying?
this.matSnackBar.open(
this.translate.instant('An email with a password reset link was send!'),
this.translate.instant('OK'),
{
duration: 0
}
);
this.router.navigate(['/login']);
} catch (e) {
console.log('error', e);
}
}
示例3: submitNewPassword
/**
* Submit the new password.
*/
public async submitNewPassword(): Promise<void> {
if (this.newPasswordForm.invalid) {
return;
}
try {
await this.http.post<void>(environment.urlPrefix + '/users/reset-password-confirm/', {
user_id: this.user_id,
token: this.token,
password: this.newPasswordForm.get('password').value
});
// TODO: Does we get a response for displaying?
this.matSnackBar.open(
this.translate.instant('Your password was resetted successfully!'),
this.translate.instant('OK'),
{
duration: 0
}
);
this.router.navigate(['/login']);
} catch (e) {
console.log('error', e);
}
}
示例4: update
update() {
const data = {
paramedic: {},
error: {},
valid: false
};
if (this.formParamedics.valid) {
const paramedic = {
_id: this.data._id,
name: this.formParamedics.get('name').value,
lastname: this.formParamedics.get('lastname').value,
phone: this.formParamedics.get('phone').value,
cellPhone: this.formParamedics.get('cellPhone').value,
gender: this.formParamedics.get('gender').value,
birthdate: this.formParamedics.get('birthdate').value,
specialization: this.formParamedics.get('specialization').value
};
data.paramedic = paramedic;
data.valid = true;
this.dialogRef.close(data);
}else {
this.errorMessage = 'Los campos marcados con * son obligatorios';
}
}
示例5: getUserDataFromForm
getUserDataFromForm() {
return {
email: this.loginForm.get('email').value,
password: this.loginForm.get('password').value
};
}
示例6:
CdValidators.custom('not-dividable-by-x', (y) => {
const x = (form && form.get('x').value) || 1;
return y % x !== 0;
})
示例7: it
it('should accept valid version 4 uuid', () => {
const x = form.get('x');
x.setValue('e33bbcb6-fcc3-40b1-ae81-3f81706a35d5');
expect(x.valid).toBeTruthy();
expect(x.hasError('pattern')).toBeFalsy();
});
示例8: it
it('should return an element of an array', () => {
const g = new FormGroup({'array': new FormArray([new FormControl('111')])});
expect(g.get(['array', 0]).value).toEqual('111');
});
示例9: password
get password() {
return this.loginForm.get("password");
}