title: Angular2 and typescript - how to add an array to a array from promise?
body: <p>In my controller, I make a rest call to create my table.  I need to append some fixed rows and I dont know how to do it.</p>
  
  <p>I want something like this:</p>
  
  <p>export class Environment {
      id: string;
      name: string;
  }</p>
  
  <pre><code>environments: any[]; 
  production = new Environment('1', 'production');
  development = new Environment('2', 'development');
  
      ngOnInit(){
              this.environmentService.getEnvironments()
                  .subscribe(environments =&gt; this.environments = environments,null,() =&gt; { this.isLoading = false; });
  
          } 
  </code></pre>
  
  <p>So how do I add an array to the promise result?" </p>
  
  <pre><code>  [this.production,this.development] + this.environments;
  </code></pre>
  
  <p>Results of proposed solution:</p>
  
  <pre><code> staging: Environment = {
          id: '111',
          name: 'staging'
  };
  
  environments = [this.staging];
  
  [ { "id": "111", "name": "staging" }, [ { "id": "86aa96e8-0383-4bce-b833-be3c21f47306", "name": "cloud" } ] ]
  </code></pre>
  
  <p>The name with cloud is from the server.  So close but should look like this:</p>
  
  <pre><code>[ { "id": "111", "name": "staging" },{ "id": "86aa96e8-0383-4bce-b833-be3c21f47306", "name": "cloud" } ]
  </code></pre>
  
  <p>This worked but is there a better way?:</p>
  
  <pre><code>this.environmentService.getEnvironments()
              .subscribe(environments =&gt; {
                  for (var i = 0; environments.length &gt; i; i++) 
                  { this.environments.push(environments[i])}
  
              },null,() =&gt; { this.isLoading = false; });
  </code></pre>