I'm trying to update an observable which is returned in html from an API call.
I'm wondering if anyone can help me with this.
The html (on another component)
<common-content [theme]="theme" ></common-content>
and the component is:
import { Component, OnInit, Input } from '@angular/core';
import { Http, Response } from '@angular/http';
import { ThemeModel } from '../../models';
import 'rxjs/add/operator/toPromise';
@Component({
  selector: 'common-content',
  template: `<div innerHTML = "{{innerHtml}}"></div>`
})
export class CommonContentComponent implements OnInit {
    @Input() page: string;
    @Input() theme: ThemeModel;
    innerHtml: string;
    constructor(private http: Http) {
    }
    ngOnInit() {
        this.populatePage();
    }
    populatePage(){
        let thisUrl = 'myPage.html';
        this.http.get(thisUrl).subscribe(f => {
            var content = <string>f['_body'];
            this.innerHtml = content.replace("{{theme.Name}}", this.theme.name);
            }, (error) => {
                let e = error;
            }, () => {
        });
    }
}
so instead of doing a "replace" the observable should just update automatically.
I've tried to use a subscribe and I also tried a promise, however I don't seem to be able to get the syntax to behave.
Can anyone help?
Thanks in advance
 
     
     
    