-1

Code:

<div class="row" *ngIf="goalStatusList;" >
  <table class="table table-hover">
    <thead>
    <tr>
      <td>Id</td>
      <td>Name</td>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let goalStatus of goalStatusList">
      <th>{{goalStatus.goalStatusId}}</th>
      <td><div *ngIf="!(goalStatus.editorEnabled)">
{{goalStatus.goalStatusName}}
<md-icon (click)="goalStatus.editorEnabled=true;">mode_edit</md-icon></div>
  <div *ngIf="(goalStatus.editorEnabled)" ><md-input-container><input mdInput value="goalStatus.goalStatusName" #goalName></md-input-container><md-icon (click)="modifyGoal()" style="color:green;font:bold;" >done</md-icon><md-icon (click)="goalStatus.editorEnabled=false" style="color:red;font:bold;" >clear</md-icon></div></td>
    </tr>
    </tbody>
  </table>
</div>

The mdInput field above does not print the goalStatusName value. Instead it simply prints goalStatus.goalStatusName.

Nehal
  • 13,130
  • 4
  • 43
  • 59
HBK
  • 735
  • 1
  • 11
  • 29

1 Answers1

0

There are two issues here

Your ngIf should be without brackets,

<td><div *ngIf="!goalStatus.editorEnabled">

and use expression in case of value

<input mdInput value="{{goalStatus.goalStatusName}}" #goalName>
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396