title: How can a mock a http observable in Angular2 for when no api is written
body: <p>I'm new to both Angular2 and Rxjs and I am a little confused about a particular case.</p>
  
  <p>I have a simple service:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Observable, Subject } from 'rxjs/Rx';
  import { Http, Response } from '@angular/http';
  
  export interface Article {
    id: number;
    title: string;
    content: string;
    author: string;
  }
  
  @Injectable()
  export class ArticleService {
    private _articles$: Subject&lt;Article[]&gt;;
    private baseUrl: string;
    private dataStore: {
      articles: Article[]
    };
    constructor(private http: Http) {
      this.baseUrl = 'http://localhost:3000'
      this.dataStore = { articles: [] };
      this._articles$ = &lt;Subject&lt;Article[]&gt;&gt;new Subject();
    }
    get articles$(){
      return this._articles$.asObservable();
    }
  
    loadAll(){
      //Observable.from(this.dummyData)
      this.http.get(`${this.baseUrl}/articles`)
      .map(response =&gt; response.json())
      .subscribe(data =&gt; {
        //debugger;
        this.dataStore.articles = data;
         // Push a new copy of our article list to all Subscribers.
        this._articles$.next(this.dataStore.articles)
      }, error =&gt; console.log('Could not load Articles'));
    }
  }
  </code></pre>
  
  <p>And this works as expected , but what I would like to do is to be able to develope my service without a api endpoint and using an Observable that I can later swap out for the <code>http.request</code> . I tried to do this using Observable.from to convert a dummy data array to an observable but I get the errors </p>
  
  <blockquote>
    <p><code>Type '{ id: number; title: string; content: string; author: string; }' is not assignable to type 'Article[]'</code></p>
  </blockquote>
  
  <p>I believe this is because it is returning each item separately instead of the array , can someone point me in the correct direction of how this should work</p>
  
  <p><strong>Update</strong>:
  for clarity the dummyData look like: </p>
  
  <pre><code>private dummyData = [
        {
          id: 1,
          title: 'Title 1',
          content: 'content 1',
          author: 'author 1'
        },
        {
          id:2,
          title: 'Title 2',
          content: 'content 2',
          author: 'author 1'
        }
      ];
  </code></pre>