第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Angular2驗(yàn)證器,它依賴于多個(gè)表單字段

Angular2驗(yàn)證器,它依賴于多個(gè)表單字段

largeQ 2019-11-06 11:10:47
是否可以創(chuàng)建一個(gè)可以使用多個(gè)值來確定我的字段是否有效的驗(yàn)證器?例如,如果客戶首選的聯(lián)系方式是通過電子郵件,則必須填寫電子郵件字段。謝謝。更新了示例代碼...    import {Component, View} from 'angular2/angular2';    import {FormBuilder, Validators, formDirectives, ControlGroup} from 'angular2/forms';    @Component({        selector: 'customer-basic',        viewInjector: [FormBuilder]    })    @View({        templateUrl: 'app/components/customerBasic/customerBasic.html',        directives: [formDirectives]    })    export class CustomerBasic {        customerForm: ControlGroup;        constructor(builder: FormBuilder) {            this.customerForm = builder.group({                firstname: [''],                lastname: [''],                validateZip: ['yes'],                zipcode: ['', this.zipCodeValidator]                 // I only want to validate using the function below if the validateZip control is set to 'yes'            });        }        zipCodeValidator(control) {            if (!control.value.match(/\d\d\d\d\d(-\d\d\d\d)?/)) {                return { invalidZipCode: true };            }        }    }
查看完整描述

3 回答

  • 3 回答
  • 0 關(guān)注
  • 775 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)