Angular 2 : What is diagnostic property in forms

标签 angular angular2-directives angular2-services angular2-forms

我不明白 angular2 网站上的这一段:

We threw in a diagnostic property at the end to return a JSON representation of our model. It'll help us see what we're doing during our development; we've left ourselves a cleanup note to discard it later.

Here is the link

什么意思

最佳答案

他们只是添加了一个 getter diagnostic 来获取模型作为字符串。然后他们将 {{diagnostic}} 添加到模板以使原始模型在测试表单时可见,以便在他们编辑表单时始终查看模型是否更新。

`{{model | json}}`

也会这样做。

关于 Angular 2 : What is diagnostic property in forms,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38115862/

相关文章:

javascript - angularjs 指令中的按钮不起作用

Angular 2 RC 5 Bootstrap 自定义 HTTP 类 TypeError : Cannot read property 'toString' of null

angular - angular4中的浏览器关闭事件

javascript - Angular2 条件表单验证器

angular - 使用 (AngularJS 2) 和 ASP.net MVC Web API 上传文件

angular - cdkDrag drop 后如何获取位置?

css - 应用来自父项的样式

javascript - localStorage 似乎在 Angular 中不起作用

javascript - 如何将获取的API的一部分添加到组件定义的数组中

angular - 我怎样才能拥有 Angular2 组件的动态 templateUrl?