0
如何在ajax请求数据到达后单独渲染模板?加载模板后可以加载数据吗?
在版本中我有一个ajax请求和请求如何延迟,窗体加载没有数据。数据加载延迟几秒钟。
这种行为不雅
@Component({
providers: [CompanyService],
templateUrl:'<input type="text" id="address" name="address" [(ngModel)]="company.address" #address="ngModel" >'
})
export class FormComponent {
private company:Company = new Company();
private acao:String = null;
constructor(private companyService:CompanyService) {
this.route.params.subscribe(params => {
if (params['id'] !== undefined) {
this.companyService.getById(params['id']).subscribe(result => this.company = result);
this.acao = 'edit';
}
});
}
我简化代码更好的视觉效果。