【发布时间】:2016-09-17 17:26:30
【问题描述】:
我正在尝试使用 ngModel 在 textarea 中打印 json 对象。
我做了以下事情:
<textarea style="background-color:black;color:white;" [(ngModel)]='rapidPage' rows="30" cols="120">
</textarea>
我想在 textarea 中加载 json 对象。上面的代码在 textarea 中加载了 rapidPage 对象,但它的 textarea 值显示为 [object Object]。
对象:
this.rapidPage = {
"pageRows": [
{
"sections": [
{
"sectionRows": [
{
"secRowColumns": [
]
},
{
"secRowColumns": [
{
"colName": "users"
}
]
},
{
"secRowColumns": [
{
"colName": "sample"
}
]
}
],
"width": 0
}
]
}
],
"pageName": "DefaultPage",
"pageLayout": "DEFAULT_LAYOUT",
"editMode": true
};
我想将数据加载为字符串。 有输入吗?
【问题讨论】:
-
rapidPage.key定位对象中的键。你可以发布这个对象吗? -
@Jai 更新了对象的问题
标签: javascript html json angular