Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (27 sloc) 755 Bytes
import { Component, Input, ChangeDetectorRef } from '@angular/core';
import { client } from '../../../shared/utils';
import { Hello } from '../../../dtos';
@Component({
selector: 'hello',
templateUrl: 'hello.html',
styleUrls: ['hello.css']
})
export class HelloComponent {
result: string;
constructor(private cdref: ChangeDetectorRef) { }
@Input() name: string;
ngOnInit() {
this.nameChanged(this.name);
}
async nameChanged(name: string) {
if (name) {
var req = new Hello();
req.name = name;
var r = await client.get(req);
this.result = r.result;
} else {
this.result = '';
}
this.cdref.detectChanges();
}
}