Understanding how to call a REST Api and displaying the data from the response in Angular 2
<p>I'm new in Angular 2 and Typescript so please excuse me for this question but I can't understand how to consume the data after successfully calling a REST Api.
I made a <a href="http://plnkr.co/edit/2dKXpSW5pXBMvxecupQC?p=preview" rel="nofollow">plunker</a> for my example so it will be easier to explain what I'm tring to do.</p>

<p>Please ignore unused imports when viewing the example.</p>

<p>Calling the function <code>getWeather</code> works fine.</p>

<pre><code>getWeather(query) {
        const endpoint = 'http://api.openweathermap.org/data/2.5/weather?q=London,uk&amp;appid=44db6a862fba0b067b1930da0d769e98';
        return this.http
            .get(endpoint)//, {search: searchParams})
            .map(res =&gt; res.json().main)
            .subscribe(res =&gt; console.log('weather json response = ' + JSON.stringify(res))
            );
    }
</code></pre>

<p>But how to store the data? I mean do I have to make an object similar like the json response and use if for displaying the data and how?</p>

<p><strong>Edit:</strong> <a href="http://plnkr.co/edit/QHYtAu?p=preview" rel="nofollow">Here</a> is a working example with my code.</p>