title: Using http rest apis with angular 2
body: <p>So, I am following angular 2 guides on their website via typescript and am stuck at http api integration. I'm trying to make a simple application that can search via soundcloud api for a song, however I have difficulties implementing and understanding how to get going and online resources do it in so many different ways (I believe do to rapid angular 2 syntax changes back in the day).</p>
  
  <p>So at the moment my project looks like this</p>
  
  <pre><code>app
    components
      home
        home.component.ts
        ...
      search
        search.component.ts
        ...
      app.ts
      ...
    services
      soundcloud.ts
    bootstrap.ts
  index.html
  </code></pre>
  
  <p>Nothing fancy going on in the example, main files would be</p>
  
  <p><strong>app.ts</strong></p>
  
  <pre><code>import {Component, View} from 'angular2/core';
  import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
  
  import {HomeComponent} from './home/home.component';
  import {SearchComponent} from './search/search.component';
  
  @Component({
      selector: 'app',
      templateUrl: 'app/components/app.html',
      directives: [ROUTER_DIRECTIVES]
  })
  
  @RouteConfig([
    {path: '/home', name: 'Home', component: HomeComponent, useAsDefault: true},
    {path: '/search', name: 'Search', component: SearchComponent}
  ])
  
  export class App { }
  </code></pre>
  
  <p><strong>bootstrap.ts</strong></p>
  
  <pre><code>    import {App}     from './components/app';
  import {bootstrap}        from 'angular2/platform/browser';
  import {ROUTER_PROVIDERS} from 'angular2/router';
  
  bootstrap(App, [
    ROUTER_PROVIDERS
  ]);
  </code></pre>
  
  <p>And I was trying to figure out <strong>soundcloud.ts</strong> however am not able to and there are errors in following approach i.e. <code>@Inject</code> is not found (I assume I am using outdated syntax here). Essentially I would like to use soundcloud service for api calls within my app form search component.</p>
  
  <pre><code>import {Injectable} from 'angular2/core'
  import {Http} from 'angular2/http'
  
  @Injectable()
  export class SoundcloudService {
   http : Http
  
   constructor(@Inject(Http) http) {
     this.http = http;
   }
  }
  </code></pre>
  
  <p>soundcloud api not included here as I can't get basics down first.</p>