本文整理匯總了TypeScript中angular2/common.Control類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Control類的具體用法?TypeScript Control怎麽用?TypeScript Control使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Control類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: checkNameAndTitle
static checkNameAndTitle(control : Control){
if(control.find("name").value === control.find("title").value)
return {titleAndName : {title: control.find("title").value}, name : control.find("name").value};
return null;
}
示例2: 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('');
});
示例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;
}
if(!this.field.isTypeFile()) {
this.fieldControl.updateValue(value);
}
}, 0);
示例4: setTimeout
setTimeout(() => {
this.control && this.control.updateValueAndValidity({ onlySelf: true, emitEvent: false });
});
示例5:
.subscribe(movie =>{
this.id.updateValue(movie.id);
this.title.updateValue(movie.title);
this.rating.updateValue(movie.rating);
this.length.updateValue(movie.length)
});
示例6:
this.friendStore.addFriend(this.form.value).subscribe( createdFriend => {
this.firstname.updateValue('');
this.lastname.updateValue('');
})