本文整理汇总了TypeScript中@angular/common.Control类的典型用法代码示例。如果您正苦于以下问题:TypeScript Control类的具体用法?TypeScript Control怎么用?TypeScript Control使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Control类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: 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('');
});
开发者ID:tja4472,项目名称:ngrx-clicker-ionic,代码行数:12,代码来源:utils.spec.ts
示例2: it
it('should check is value is a valid email', () => {
let control = new Control('[email protected]');
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);
});
开发者ID:haiko,项目名称:ng2-form-utils,代码行数:16,代码来源:form.validators.spec.ts
示例3: 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);
开发者ID:billirg,项目名称:angular-spring-dynamic-form,代码行数:15,代码来源:extra-field.ts
示例4: 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]);
}
开发者ID:thorstenschaefer,项目名称:d3-playground,代码行数:10,代码来源:gdp.component.ts
示例5: 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('');
}
}
开发者ID:riblee,项目名称:chat-client,代码行数:13,代码来源:roomDetail.component.ts
示例6:
.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;
}
});
开发者ID:isman-usoh,项目名称:followork,代码行数:16,代码来源:login.ts
示例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;
}
});
开发者ID:isman-usoh,项目名称:followork,代码行数:20,代码来源:register.ts
示例8:
res => {
this.ctrlRegPasswordConfirm.updateValue("");
this.login();
this.turnOffError();
},
开发者ID:mducnguyen,项目名称:TicklrClient,代码行数:5,代码来源:auth.component.ts
注:本文中的@angular/common.Control类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论