I have One component and I want it to pass data to another one which is in another module. Actually my
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-left">
<li><a routerLink="link1" routerLinkActive="active">Page1</a></li>
<li><a routerLink="link2" routerLinkActive="active">Page2</a></li>
<li><a routerLink="link3" routerLinkActive="active">Page3</a></li>
<li><a routerLink="link4" routerLinkActive="active">Page4</a></li>
<div *ngIf="needsSidebar" id="sidebar">some content</div>
It doesn't matter how the modules are related. What matters is, if the components are children in a components view. In this case you can use Angulars binding syntax. In other cases use a shared service. For details see https://angular.io/docs/ts/latest/cookbook/component-communication.html
What also matters is, where you add a shared service as provider. If you add it to a component, only an instance of this component and its children and descendants share this service instance.
If you add a service to providers of
@NgModule() a single instance is shared with the whole application (for non-lazy loaded modules).