pass value from parent to child

后端 未结 2 429
遇见更好的自我
遇见更好的自我 2021-01-15 10:17

this is my layout.html

2条回答
  •  天命终不由人
    2021-01-15 10:28

    Use Event Emitter. It will call parent component method and you can pass your any object in that method call as below:

    Child Component:

    import {ViewChild, Component, Output, EventEmitter}   from "@angular/core";
    
    @Output() RefreshParentGridView = new EventEmitter();
    
    public Close(): void {       
         let myObject:any; //Your object which pass in parent
         this.RefreshParentGridView.emit(myObject);               
    }  
    

    Parent Component: register output event as below

    HTML

    
    

    Backend Code

    public RefreshGridView(model: any)
    {
    }
    

提交回复
热议问题