title: Angular 2 send data from component to service
body: <p>My target is to send data from Angular component to service and use service methods to work on it. Example:</p>
  
  <pre><code>export class SomeComponent {
      public data: Array&lt;any&gt; = MyData;
      public constructor(private myService: MyService) {
        this.myService.data = this.data;
      }
  }
  </code></pre>
  
  <p>and service:</p>
  
  <pre><code>@Injectable()
  export class TablePageService {
      public data: Array&lt;any&gt;;
      constructor() {
          console.log(this.data);
          // undefined
      }
  }
  </code></pre>
  
  <p>Getting data is undefined. How to make it works?</p>