title: Access to the variables in the template from other component
body: <p>I need help with setting variables in the template from other components. </p>
  
  <p>For example:</p>
  
  <p><strong>AppComponent</strong></p>
  
  <pre><code>@Component({
      selector: 'app',
      templateUrl: '/templates/layout',
      directives: [ROUTER_DIRECTIVES, RouterLink]
  })
  
  export class AppComponent {
  
      currentShop:Shop;
  
      constructor(router: Router, shopProvider:ShopProvider){
          shopProvider
              .getCurrentShop()
              .toPromise()
              .then((response) =&gt; {
                  router.navigate(['/System']);
              });
      }
  }
  </code></pre>
  
  <p><strong>Template:</strong></p>
  
  <pre><code>&lt;app&gt;
      &lt;div&gt;{{currentShop.name}}&lt;/div&gt;
  &lt;/app&gt;
  </code></pre>
  
  <p><strong>Shop:</strong></p>
  
  <pre><code>export class Shop{
  
      private _id;
  
      private _name;
  
      constructor(id:number, name:string) {
          this._id = id;
          this._name = name;
      }
  
      get id() {
          return this._id;
      }
  
      get name() {
          return this._name;
      }
  }
  </code></pre>
  
  <p><strong>SystemComponent:</strong></p>
  
  <pre><code>@Component({
      template: '',
      directives: [RouterOutlet]
  })
  
  export class SystemComponent{
  
      private _routeParams:RouteParams;
  
      private _shopProvider:ShopProvider;
  
      currentShop:Shop;
  
      constructor(routeParams:RouteParams,shopProvider:ShopProvider){
          this._routeParams = routeParams;
          this.currentShop = new Shop(1, 'Test');
      }
  
  }
  </code></pre>
  
  <p>After I run the application I get this error: </p>
  
  <pre><code>[Error] EXCEPTION: TypeError: undefined is not an object (evaluating 'l_currentShop0.name') in [{{currentShop.name}} in AppComponent@22:12]
  </code></pre>
  
  <p>If I try to set up currentShop directly from the AppComponent, there is no problem. From SystemComponent it does not work.</p>