angular - 无法在角度电子邮件编辑器中读取未定义的属性“值”
问题描述
当我尝试加载数据时出现此错误
HTML
<button (click)="exportHtml()">Export</button>
<button (click)="loadDesign()">Import</button>
<email-editor></email-editor>
打字稿
export class EmailComponent implements OnInit {
data: any
@ViewChild(EmailEditorComponent) private emailEditor: EmailEditorComponent;
constructor(private emailService: EmailService) { }
exportHtml() {
this.emailEditor.exportHtml((data: { chunks: any, design: any, html: any }) => {
this.data = data
})
}
loadDesign() {
console.log(this.data)
this.emailEditor.loadDesign(this.data)
}
}
解决方案
我找到了解决方案。我犯了一个错误,我传递了整个对象 contains和html
properties 。实际上该方法需要属性。json
design
design
loadDesign() {
console.log(this.data)
this.emailEditor.loadDesign(this.data.design)
}
推荐阅读
- maven - POST 和 PUT 的状态代码通过 pom.xml mvn 测试失败
- java - Java JKS API:keyStore 为空
- reactjs - Gatsby - 构建 - WebpackError:不变量失败
- titanium - Titaniumorientationchange 事件不触发
- javascript - 输入组件:React 无法识别 DOM 元素上的道具
- android - Android:如何创建 TextInputLayout 的自定义 UI
- visual-studio - 使用 VTK 在 3D 图像中进行清晰的血管分割
- kotlin - kotlin 有按名称参数支持吗?
- reactjs - 如何在 JSON 对象中使用 JSX
- wpf - 选项卡控件中的 WPF DataGrid 扩展超出窗口