使用Angular和Laravel创建CRUD应用程序时,如何在创建应用程序的更新模块时填充Angular React Form组件
我尝试传递来自API的接收数据。使用以下代码
ngOnInit() {
this.route.paramMap.subscribe((params: ParamMap) => {
const id = parseInt(params.get('id'), 10);
this.viewID = id;
});
this.dashboardeditService.dashbordContent(this.viewID).subscribe(post => {
this. _contents = post;
this.myForm = this. _contents;
console.log(this. _contents);
} );
// this.pageEdit.patchValue(this._contents);
this.pageEdit = new FormGroup({
title: new FormControl('', Validators.required),
menu: new FormControl('', Validators.required),
body: new FormControl('', Validators.required),
picture: new FormControl(''),
});