如何基于在primeng中使用angular2可用的数据显示和隐藏图标

时间:2018-10-11 12:01:32

标签: angular primeng

我有一个部分,如果行中有数据,则必须显示more-info图标或将其隐藏。

HTML:

 <div class="col-sm-12 m-t10" formArrayName="ActivityParent">
        <table class="table table-bordered emr-activity">
          <thead>
            <tr>
              <th>Outcome Code</th>
              <th>Outcome Reference</th>
              <th class="w-90x">Actions</th>
            </tr>
          </thead>
          <tbody *ngFor="let itemrow of emrCarePlanDetailsForm.get('ActivityParent').controls;let i = index;" [formGroupName]="i">
            <tr>
              <td>
                <input type='text' (keyup)="searchDropDown(58, src4.value,i)" #src4 formControlName="OutcomeCodeableConcept"
                  minlength="3" placeholder="Please key in(eg:d)"/>
                <div *ngIf="outcomeType && IsHidden && contactIndex == i  " class="emr-dropdown">
                  <ul *ngFor="let oType of outcomeType" (click)="getValue(oType,i)" class="p-l10 m-b0 brd-b">
                    <li>
                      {{oType.Description}}
                    </li>
                  </ul>
                </div>
              </td>
              <td>
                <input type="text" formControlName="outcomeReference" maxlength="50" placeholder="Outcome Reference" (input)="inputValidator($event)" required>
              </td>




              <td>
                <a class="p-l5" (click)="saveActivityDetails(itemrow)">
                  <i class="fa fa-save"></i>
                </a>
                <a class="p-l5" (click)="showActivityDetails(itemrow.value)" *ngIf="itemrow.isActivityInfo">
                  <i class="fa fa-clone"></i>
                </a>
                <a class="p-l5" (click)="deleteDetails(i)">
                  <i class="fa fa-times-circle"></i>
                </a>
              </td>
            </tr>
          </tbody>
        </table>
      </div>

TS:

 saveActivityDetails(itemrow) {
    console.log(itemrow);
    if (itemrow.value != '') {
      itemrow.isActivityInfo = true;
    }
  }

在这里单击保存按钮,我能够显示more-info(中间)图标,但是当我刷新页面或如果其中存在数据时,我会隐藏中间图标。

0 个答案:

没有答案