Guest User

Untitled

a guest
Jan 23rd, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <child-comp [addItem]="addItem" [isApproved]="isApproved"> </child-comp>
  2.  
  3. export class Child{
  4. Input () addItem: boolean;
  5. Input () isApproved: boolean;
  6. MyList=[];
  7.  
  8. PushNewItemToMyList(){ /*code relevant to adding a new list item*/ }
  9.  
  10. ngOnChanges(){
  11. if (this.addItem){
  12. this.PushNewItemToMyList();
  13. this.addItem=!this.addItem; /* Negation line #1 */
  14. }
  15.  
  16.  
  17. if (this.isApproved){
  18. this.MyList[i].icon='new.png';
  19. this.isApproved=!this.isApproved; /* Negation line #2 */
  20. }
  21. }
  22. }
Add Comment
Please, Sign In to add comment