我不确定为什么它无法解析绑定 - 它们每个都包含内容。这是错误消息:
Uncaught Exception (js): Uncaught Error: Unable to parse bindings.
Message: ReferenceError: Users is not defined;
Bindings value: template: { name: 'grid', foreach: Users}
看法:
<div data-bind="foreach: RoleTypes">
<h3><!--ko text: RoleName--><!--/ko--> (<!--ko text: UserCount--><!--/ko-->)</h3>
<div id="gridView" data-bind="template: { name: 'grid', foreach: Users}">
<section id="Images">
<section id="users"></section>
</section>
</div>
</div>
Javascript:
var getRoles = function () {
Ajax.Get({
Url: ...,
DataToSubmit: {id: properties.Id },
DataType: "json",
OnSuccess: function (roleData, status, jqXHR) {
// bind role types
bindModel(roleData);
Ajax.Get({
Url: ...,
DataToSubmit: { pageNumber: 1, id: properties.Id },
DataType: "json",
OnSuccess: function (userData, status, jqXHR) {
}
});
}
});
};
我不确定要分享我的 javascript 的哪些其他部分来帮助解决这个问题,但请告诉我。