passing one component data to other component
I am getting response from server,I want pass this response to other component for displaying. I tried in one way but getting undefined. Tried this way how to pass one component service response to other component in angular 2 . yesterday got the results faced routing. Changed little bit created separated components. mainsearch.component.ts: export class MainsearchComponent { selected; skipCount: number = 0; errorMessage: string; searchedResults: any; searchObj: Object = { skipCount: this.skipCount }; onChange(newVlaue) { console.log(newVlaue); this.selected = newVlaue; } constructor(private