Angularjs ng中的可编辑ng模型重复不工作
我有一个简单的代码,用户可以在contenteditable中编辑数据。为此,我使用了contenteditable from。 在ng中,重复ng模型绑定过程不起作用。这是我的密码Angularjs ng中的可编辑ng模型重复不工作,angularjs,html,Angularjs,Html,我有一个简单的代码,用户可以在contenteditable中编辑数据。为此,我使用了contenteditable from。 在ng中,重复ng模型绑定过程不起作用。这是我的密码 <div class="list card listinfo" ng-repeat="(key,dtls) in ddetails.details"> <h2 contenteditable="true" ng-model="dtls.title"></h2> &
<div class="list card listinfo" ng-repeat="(key,dtls) in ddetails.details">
<h2 contenteditable="true" ng-model="dtls.title"></h2>
<p contenteditable="true" ng-model="dtls.subtitle"></p>
</div>
控制台输出如下:
$id: "darjeeling"
$priority: null
details: Object
-KAyw0psnsBBLtnHSeJj: Object
address: ",India"
email: "test@gmail.com"
phone: "+91-"
shortDesc: "Short Description"
subtitle: "Sub Title"
title: "Title"
website: "http://www.google.com"
__proto__: Object
-KB8E8bHM2enqA4VnZkX: Object
-KB8E57BeUsuNw1R4m9E: Object
-KB8E60Pnm1sFCPaFL7I: Object
-KBBUfmzn7Ym6p0O7oQH: Object
-KBBUrCgoBKqKsXB_C4H: Object
__proto__: Object
shortDesc: "work test fdsfds"
title: "Dazzling Dfdfeling"
做一些类似的事情(它真的被命名为ddetails?):
每次重复都会得到整个对象,它应该绑定到原始数组。根据Angular JS文档。ng模型绑定表单元素检查此
其中as ng bind html与任何html元素一起工作在ng repeat中尝试{{detail}},以查看是否有任何数据(在或什么之前)。可能您的数组是空的,或者命名错误。检查数组中的数据。如果有数据,请尝试在ng repeat表达式的末尾添加“track by$index”。如果我尝试ng bind html=“dtls.title”,则会出现数据。但它在ng模型中没有约束力。我已经安慰了它,数据就要来了。我还跟踪了$index,并键入了所有内容。请用数组的初始化更新您的问题。我已经初始化了,使用ng bind htmlYou是正确的。您应该向我们显示代码,在哪里初始化它。我看不到HTML中的错误。这是正在运行的代码
$scope.ddetails = FBFactory.getDM($stateParams.ddata);
$id: "darjeeling"
$priority: null
details: Object
-KAyw0psnsBBLtnHSeJj: Object
address: ",India"
email: "test@gmail.com"
phone: "+91-"
shortDesc: "Short Description"
subtitle: "Sub Title"
title: "Title"
website: "http://www.google.com"
__proto__: Object
-KB8E8bHM2enqA4VnZkX: Object
-KB8E57BeUsuNw1R4m9E: Object
-KB8E60Pnm1sFCPaFL7I: Object
-KBBUfmzn7Ym6p0O7oQH: Object
-KBBUrCgoBKqKsXB_C4H: Object
__proto__: Object
shortDesc: "work test fdsfds"
title: "Dazzling Dfdfeling"
<div class="list card listinfo" ng-repeat="detail in ddetails.details">
<h2 contenteditable="true" ng-model="detail.title"></h2>
<p contenteditable="true" ng-model="detail.subtitle"></p>
</div>