本文整理匯總了TypeScript中@angular/common.Control.updateValue方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Control.updateValue方法的具體用法?TypeScript Control.updateValue怎麽用?TypeScript Control.updateValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular/common.Control
的用法示例。
在下文中一共展示了Control.updateValue方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: showAllData
/**
* Sets the filters for year from and year to such that all data is shown.
*/
showAllData() {
if (!this.years)
return;
this.yearFrom.updateValue(this.years[0]);
this.yearTo.updateValue(this.years[this.years.length-1]);
}
示例2: send
/**
* Form submit handler.
* Send a Message to the Room with id.
*/
send() {
if (this.message.valid) {
// Send message to server
this._roomService.sendMessage(parseInt(this._routeParams.get('id')), this.messageForm.value.message);
// Reset the form
this.message.updateValue('');
}
}
示例3: it
it('resets a control', () => {
let control: Control = new Control('');
let returnedControl: AbstractControl = null;
control.markAsTouched();
control.updateValue('dave');
returnedControl = Utils.resetControl(control);
expect(returnedControl.touched).toBe(false);
expect(returnedControl.untouched).toBe(true);
expect(returnedControl.pristine).toBe(true);
expect(returnedControl.dirty).toBe(false);
expect(returnedControl.value).toBe('');
});
示例4: setTimeout
setTimeout(()=> {
this.formDir.form.addControl(this.field.name,this.fieldControl);
let value:any = '';
if(this.entity && this.entity.extraFields && this.entity.extraFields[this.field.name]) {
value = this.entity.extraFields[this.field.name];
} else if(this.field.hasValue()) {
value = this.field.value;
this.entity.extraFields[this.field.name] = value;
console.log(this.entity);
}
if(!this.field.isTypeFile()) {
this.fieldControl.updateValue(value);
}
}, 0);
示例5:
.catch(error => {
this.password.updateValue("");
if (error.code === "auth/invalid-email" || error.code === "auth/wrong-password") {
this.showLoginFailure("Email or password invalid");
return;
}
if (error.code === "auth/user-disabled") {
this.showLoginFailure("User has been disabled");
return;
}
if (error.code === "auth/user-not-found") {
this.showLoginFailure("User not found");
return;
}
});
示例6: it
it('should check is value is a valid email', () => {
let control = new Control('test@test.nl');
let result: ValidationResult = FormValidators.isMailAddress(control);
expect(result).toBeDefined();
expect(result['mail_format_error']).toBe(false);
// set value to alphanumeric
control.updateValue('abc');
result = FormValidators.isMailAddress(control);
expect(result['mail_format_error']).toBe(true);
});
示例7:
.catch(error => {
this.password.updateValue("");
if (error.code === "auth/email-already-in-use") {
this.showLoginFailure("Email already exists an account");
return;
}
if (error.code === "auth/invalid-email") {
this.showLoginFailure("Email address is not valid");
return;
}
if (error.code === "auth/operation-not-allowed") {
this.showLoginFailure("Email/password accounts are not enabled");
return;
}
if (error.code === "auth/weak-password") {
this.showLoginFailure("Password is not strong enough");
return;
}
});
示例8:
res => {
this.ctrlRegPasswordConfirm.updateValue("");
this.login();
this.turnOffError();
},