Guest User

Untitled

a guest
Oct 21st, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <tr *ngFor="let project of projects">
  2. <td>{{ project.name }}</td>
  3. <td>{{ project.description }}</td>
  4. <td>
  5. <button type="button" class="btn btn-sm btn-primary bigger" (click)="onEditProject(project.id)"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit</button>
  6. </td>
  7. <td>
  8.  
  9. <ng-container *ngIf="getProjectType(project.id)">
  10. <ng-template *ngIf="getProjectType(project.id) === 'new'">
  11. <button type="button" class="btn btn-sm btn-primary" (click)="onCreateBOM(project.id)"><i class="fa fa-plus-circle" aria-hidden="true"></i> Create Bill of Material</button>
  12. </ng-template>
  13.  
  14. <ng-template *ngIf="getProjectType(project.id) === 'exist'">
  15. <button type="button" class="btn btn-sm btn-success" (click)="onEditBOM(project.id)"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit Bill of Material</button>
  16. </ng-template>
  17.  
  18. </ng-container>
  19. </td>
  20. </tr>
  21.  
  22. public getProjectType(project_id): 'new' | 'exist' | null {
  23. return project_id.material_projects.id === project_id ? 'new'
  24. : project_id.material_projects.id === project_id ? 'exist'
  25. : null;
  26. }
Add Comment
Please, Sign In to add comment