Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Component({...})
- export class ListThirdPartyComponent {
- public showEditForm = false;
- @Input() thirdParties = [];
- public thirdPartyToEdit = {};
- public indexThirdPartyToEdit: number;
- constructor() {}
- private editThirdParty(thirdParty, index) {
- this.thirdPartyToEdit = thirdParty
- this.indexThirdPartyToEdit = index
- this.showEditForm = true;
- }
- }
- <div class="third-party-block">
- <div *ngFor="let thirdParty of thirdParties, let i = index">
- <div class="third-party-element">
- <span (click)="editThirdParty(thirdParty, i)" (click)="thirdParty.form = true" (click)="thirdParty.hideme = false">Edit</span>
- {{thirdParty.name}}
- <div>Role: {{thirdParty.role}}</div>
- <div>Email: {{thirdParty.email}}</div>
- <div>Phone: {{thirdParty.phone}}</div>
- <div>Ext.: {{thirdParty.ext}}</div>
- <edit-third-party
- *ngIf="showEditForm"
- [hidden]="!thirdParty.form"
- [thirdParty]="thirdPartyToEdit>
- </edit-third-party>
- </div>
- </div>
- </div>
- @Component({...})
- export class EditThirdPartyComponent {
- @Input() thirdParty: any;
- @Output() hideEditThirdParty = new EventEmitter<any>();
- constructor (private requestDist: RequestDistService) {}
- onSubmit(value: any) {
- this.hideEditThirdParty.emit(value)
- }
- }
Add Comment
Please, Sign In to add comment