【发布时间】:2018-03-19 20:51:40
【问题描述】:
我有一个父页面来列出网格中的项目,并且在其编辑/新事件中,我必须在模型中显示一个带有网格的模型。网格本身是另一个组件。
除了网格之外,模型上还有两个文本框,它们是包含子组件(网格)的父组件的一部分。 跟随屏幕抓取,其中红色标记的是子组件。
这里是子组件选择器声明
@Component({
selector: 'app-userlist',
templateUrl: 'userlist.component.html'
})
在模型上,当我们提交这个事件时触发
onSubmit(): void {
this.http.post(this.baseUrl + "api/TemplateCategory", this.templatecategory).subscribe(result => {
//todo did it save properly or return an error?
$("#newTemplateCategoryModal").modal("hide");
this.templatecategorySaved.emit(this.templatecategory);
}, error => {
alert("post error\nStatus Code: " + error.status + "\nMessage:" + error._body);
});
}
所以我的问题是我们如何在保存时获取网格(子组件)值。在网格中有一个用于为每个用户选择角色的下拉菜单。
【问题讨论】:
标签: angular