Embarking on my journey to create Angular2 with TypeScript for the first time and seeking guidance. The initial request is functioning correctly and I am able to display it. Upon clicking, I wish to initiate a new request. How can this be achieved?
export class App {
img: Array<Object>;
constructor(http:Http) {
http.request('http://boroviha.dev.ooosis.com/api/client/get_photo_sections.php').toRx().subscribe(res => {
console.log('img', res.json().data);
this.img = res.json().data;
});
}
onSelect(item: img) {
this.selectedItem = item;
console.log(item);
constructor(http:Http) {
this.http.request('http://localhost:3001/api/random-quote')
.map(res => res.text())
.subscribe(
data => this.randomQuote = data,
err => this.logError(err),
() => console.log('Random Quote Complete')
);
}
}
}
bootstrap(App, [HTTP_BINDINGS, bind(RequestOptions).toClass(MyOptions)])
.catch(err => console.error(err));