Skip to content

Instantly share code, notes, and snippets.

@tkssharma
Created June 27, 2016 06:58
Show Gist options
  • Save tkssharma/13a7219d4d8719a8692f81f719658976 to your computer and use it in GitHub Desktop.
Save tkssharma/13a7219d4d8719a8692f81f719658976 to your computer and use it in GitHub Desktop.
import {Component} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Rx';
@Component({
selector: 'demo-app',
template:`
<h1>Angular2 HTTP Demo App</h1>
<h2>Foods</h2>
<ul>
<li *ngFor="let food of foods">{{food.name}}</li>
</ul>
<h2>Books and Movies</h2>
<h3>Books</h3>
<ul>
<li *ngFor="let book of books">{{book.title}}</li>
</ul>
<h3>Movies</h3>
<ul>
<li *ngFor="let movie of movies">{{movie.title}}</li>
</ul>
`
})
export class AppComponent {
public foods;
public books;
public movies;
constructor(private http: Http) { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment