<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Angular 身份驗證控件

      ng g c shared/identity-input

      ng g c shared/area-list

       1,添加領域對象

      export enum IdentityType {
        IdCard = 0,
        Insurance,
        Passport,
        Militory,
        Other
      }
      export interface Address {
        provice: string,
        city: string,
        district: string,
        street?: string
      }
      
      export interface Identity {
        identityNo: string;
        identityType: IdentityType
      }
      export interface User {
        id?: string;
        email: string;
        name?: string;
        password?: string;
        avatar?: string;
        projectIds?: string[];
        taskIds?: string[];
        address?: Address;
        dateOfBirth?: string;
        identity?: Identity;
      }

      2,身份輸入UI template

      <div>
          <mat-form-field>
              <mat-select placeholder="證件類型" (change)="onIdTypeChange($event.value)" [(ngModel)]="identity.identityType">
                  <mat-option *ngFor="let type of identityTypes" [value]="type.value">
                      {{ type.label }}
                  </mat-option>
              </mat-select>
          </mat-form-field>
      </div>
      <div class="id-input">
          <mat-form-field class="full-width">
              <input matInput type="text" placeholder="證件號碼" (change)="onIdNoChange($event.target.value)"
                  [(ngModel)]="identity.identityNo" />
              <mat-error>證件號碼輸入有誤</mat-error>
          </mat-form-field>
      </div>
      View Code

      3, 身份類型和身份號碼

      private _idType = new Subject<IdentityType>();
      private _idNo = new Subject<string>();
      private _sub: Subscription;  
      
      ngOnInit(): void {
          const idType$ = this.idType;
          const idNo$ = this.idNo;
          const val$ = combineLatest([idType$, idNo$]).pipe(
            map(([_type, _no]) => ({
              identityType: _type,
              identityNo: _no
            }))
          );
          this._sub = val$.subscribe(v => {
            this.identity = v;
            this.propagateChange(v);
          });
        }
      
      onIdTypeChange(idType: IdentityType) {
          this._idType.next(idType);
        }
      
      onIdNoChange(idNo: string) {
          this._idNo.next(idNo);
        }
      
      
      private get idType(): Observable<IdentityType> {
          return this._idType.asObservable();
        }
      
      private get idNo(): Observable<string> {
          return this._idNo.asObservable();
        }

       

       

       在UI中調用

      1,在注冊組件中新開一個tab使用

      <mat-tab label="個人信息">
              <div class="full-width">
                <app-identity-input formControlName="identity"></app-identity-input>
              </div>
              <div class="full-width">
                <app-age-input formControlName="dateOfBirth"></app-age-input>
              </div>
              <div class="full-width">
                <app-area-list formControlName="address"></app-area-list>
              </div>
      </mat-tab>

       2,希望輸入身份證的時候同時改變出生日期和地址

      自定義表單控件和普通表單控件一樣,都可以通過valueChanges模式獲得流。

          const identity = this.form.get('identity');
          if (!identity) {
            return;
          }
          const id$ = identity.valueChanges.pipe(
            debounceTime(300), //濾波
            filter(v => identity.valid) //驗證通過的時候才能把數據放出來
          );

      3,訂閱流,從身份信息中讀取出來有用的信息,比如生日和地址,把它set回其他兩個控件。

       

       

       

       

       

       

       

       

       

       

       

      100

       

      posted @ 2021-03-05 08:32  starof  閱讀(124)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 人妻激情一区二区三区四区| 精品国产成人三级在线观看| 精品久久久中文字幕人妻| 亚洲真人无码永久在线| 亚洲综合色婷婷中文字幕| 国产精品视频一区不卡| 欧美18videosex性欧美tube1080 | 久久精品无码精品免费专区| 日本a在线播放| 精品一区二区三区少妇蜜臀| 国产精品久久久久9999| 精品国产精品中文字幕| 久爱无码精品免费视频在线观看| 欧美大胆老熟妇乱子伦视频| 天天弄天天模| 国产精品爆乳奶水无码视频免费| 国产一区二区三区九精品| 成人无码h真人在线网站| 99久久精品费精品国产一区二| 国产gaysexchina男外卖| 一区二区三区国产不卡| 人妻激情偷乱一区二区三区| 精品福利一区二区三区免费视频| 国产精品尤物午夜福利| 国产三级a三级三级| 一本色道久久—综合亚洲| 国产精品一二三中文字幕| аⅴ天堂中文在线网| 97久久精品人人澡人人爽| 成人乱码一区二区三区四区 | 精品久久久久久无码人妻蜜桃 | 人人妻人人插视频| 精品尤物国产尤物在线看| 亚洲蜜臀av乱码久久| 精品人妻无码一区二区三区性| 一区二区三区成人| 久久精品国产清自在天天线| 亚洲综合国产一区二区三区| 国产精品午夜福利在线观看| h无码精品3d动漫在线观看| 熟女丝袜潮喷内裤视频网站|