title: How to create an Observable from static data similar to http one in Angular?
body: <p>I am having a service that has this method:</p>
  
  <pre><code>export class TestModelService {
  
      public testModel: TestModel;
  
      constructor( @Inject(Http) public http: Http) {
      }
  
      public fetchModel(uuid: string = undefined): Observable&lt;string&gt; {
          if(!uuid) {
              //return Observable of JSON.stringify(new TestModel());
          }
          else {
              return this.http.get("http://localhost:8080/myapp/api/model/" + uuid)
                  .map(res =&gt; res.text());
          }
      }
  }
  </code></pre>
  
  <p>in the component's constructor I am subscribing like this:</p>
  
  <pre><code>export class MyComponent {
     testModel: TestModel;
     testModelService: TestModelService;
  
     constructor(@Inject(TestModelService) testModelService) {
        this.testModelService = testModelService;
  
        testService.fetchModel("29f4fddc-155a-4f26-9db6-5a431ecd5d44").subscribe(
            data =&gt; { this.testModel = FactModel.fromJson(JSON.parse(data)); },
            err =&gt; console.log(err)
        );
     }
  }
  </code></pre>
  
  <p>This works if an object comes from the server but I am trying to create an observable that will work with the given <code>subscribe()</code> call for a static string (this happens when <code>testModelService.fetchModel()</code> does not receive an uuid) so there is seamless handling in both cases.</p>