Why can't I update the data in the View from a function within a class?
wrap.component.ts
@Component({
selector: 'wrap',
templateUrl: './templates/wrap.html'
})
export class WrapComponent {
public test: string;
constructor () {
this.test = 'Hello world';
}
fun () {
this.test = 'SPAM';
}
}
express.component.ts
import {WrapComponent} from './wrap.component';
export class Express {
constructor () {
new WrapComponent().fun();
}
}
wrap.html
<h2>{{test}}</h2>
Why does the test variable in the view still show 'Hello world'?