Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在文本字段中键入@打开日期选择器2+;_Javascript_Angular_Ngx Bootstrap - Fatal编程技术网

Javascript 在文本字段中键入@打开日期选择器2+;

Javascript 在文本字段中键入@打开日期选择器2+;,javascript,angular,ngx-bootstrap,Javascript,Angular,Ngx Bootstrap,当键入@获取用户列表时,我有一个文本框,当键入\获取标记列表时,我有一个文本框,当键入@时,打开我正在使用的日期选择器。ngx引导日期选择器。 -我尝试动态添加bsDatepicker它已成功添加,但无法获取日期选择器对话框。我认为它在DOM中的注册并不完美 HTML 有想法的人请分享 谢谢 <div *ngIf="addCard" class="mx-2"> <input type="text" class="form-control" (ke

当键入@获取
用户列表
时,我有一个文本框,当键入\获取
标记列表
时,我有一个文本框,当键入@时,打开我正在使用的日期选择器。ngx引导日期选择器。

-我尝试动态添加
bsDatepicker
它已成功添加,但无法获取日期选择器对话框。我认为它在DOM中的注册并不完美

HTML

有想法的人请分享

谢谢

        <div *ngIf="addCard" class="mx-2">
        <input type="text" class="form-control" (keyup)="getVal()" id="input_2" [formControl]="cardName" >
           <ng-container *ngIf="drpBind">
            <div class="searchresults" *ngFor="let i of lstbindData; let index = index" (click)="selectVal(i)">{{i}}
            </div>
           </ng-container>
       </div>
  lstbindData: any = [];
  addCard: boolean = false;
  drpBind: boolean = false;
  getDatePicker: boolean = false;
  cardName = new FormControl();

 getVal() {
  const val = this.cardName.value;
  console.log('val', val);
  const value = val == '@' ? 1 : val == '#' ? 2 : val == '@@' ? 3 : 4;
   if (value == 1) {
     this.drpBind = true;
     this.lstbindData = this._cS.getAtkeywords();
   }
   else if (value == 2) {
     this.drpBind = true;
     this.lstbindData = this._cS.getHaskeywords();
   }
   else if (value == 3) {
     this.drpBind = false;
     var getEle1 = document.getElementById('input_2'); 
     getEle1.setAttribute('bsDatepicker', ''); //I'm trying to setAttribute it added successfully but datepicker it not getting.
   }
    else {
      this.drpBind = false;
    }
 }