how to pass content one Component to another Component using master Component in angular 2

后端 未结 1 2028
野的像风
野的像风 2021-01-26 11:47

app.module.ts

@NgModule({
  imports:      [ BrowserModule, FormsModule, HttpModule,MyDatePickerModule ],
 declarations: [ AppComponent,HeaderComponent,
                  


        
相关标签:
1条回答
  • 2021-01-26 12:00

    You have to create one common service which shared between your HeaderComponent and ContentComponent and with this service you can communicate between HeaderComponent and ContentComponent. Check Component communication via a service documentation and my answer for parent-child or sibling component comunication.

    After you have made common service you have to emit the events from HeaderComponent on select dropdown value change which needs to be already subscribe by ContentComponent so that you can perform your functionality based on dropdown value change

    0 讨论(0)
提交回复
热议问题