I am building a simple web application which uses one endpoint ( let's say www.domain.com/card/cardname ) which returns an object as such:
{
  name: 'john',
  type: 'male',
  text: 'funny guy'
}
I have an array of objects with predefined 'cardnames', for example:
Cards = [
  { name: 'john' },
  { name: 'jack' },
  { name: 'jill' }
];
I have two views, one for all cards (list view), and one for each card (detail view).
Now, I make one call for every card in order to build my 'list view' (the names are not enough for the list view, I need one property that I can only get from the endpoint - say 'type').
When I want to click on one item of the list and get the full information, I would like to avoid making an extra HTTP call as I have the same data already 'available'.
1) What is the best practice in order to temporarily save my data? (localstorage?, sessionstorage?, save everything in an array?)
2) Practically, how do I push all http replies to an array, considering this is my Service code? (using observables)
@Injectable()
export class CardService {
    private baseCorsUrl = 'https://crossorigin.me/';
    private privateUrl = 'http://localhost:3335/cardname/';
    private cardDataUrl = 'http://yugiohprices.com/api/card_data/';  // URL to web API
    constructor (private http: Http) {}
    public getDetailedInfo(card): Observable<Card> {
        return this.http.get(`${this.privateUrl}${card.name}`)
            .map(this.extractData);
    }
    private extractData(res: Response) {
        let body = res.json();
        return new Card(body.data.name, body.data.card_type, body.data.text);
    }
}
 
    