"NO_MODIFICATION_ALLOWED_ERR"이 발생합니다.
나는 이것으로 시작한다 :
<script src="/Scripts/jquery-1.6.2.min.js" ...
<script src="/Scripts/knockout-1.2.1.debug.js" ...
<script src="/Scripts/knockout.mapping-latest.js" ...
<script src="/Scripts/jquery.unobtrusive-knockout.min.js" ...
그런 다음 서버에서 플랫 JSON 개체를 가져 오기 시작할 각 속성을 DOM의 일치하는 요소에 바인딩합니다.
$.ajax({
url: '/GetRecord',
type: 'POST',
dataType: 'json',
data: JSON.stringify(requestObject),
contentType: 'application/json; charset=utf-8',
success: function (data) {
// Clear the current view model
VM.Items.length = 0;
// only one item coming from server
VM.Items[0] = ko.mapping.fromJS(data.BlankItem);
// for each property found, bind it to the matching DOM element
$.each(VM.Items[0], function (indexInArray, valueOfElement) {
var attrName = indexInArray;
// skip over things not an accessor (get/set property function)
if( typeof valueOfElement == "function")
{
var attrValue = valueOfElement();
// if it's a checkbox, bind the checked attribute
var a = $('input[name="' + attrName + '"][type="checkbox"]');
if (a.length)
a.dataBind({ checked: attrName });
// if it's a radio, bind all the found radio checked attributes
var b = $('input[name^="' + attrName + '"][type="radio"]');
if (b.length)
b.dataBind({ checked: attrName });
// if it's a text, bind the text attribute
var c = $('input[name="' + attrName + '"][type="text"]');
if (c.length)
c.dataBind({ text: attrName }); // <--- Error (use value)
}
});
// Then set knockout loose
ko.applyBindings( VM.Items[0] );
}
});
오류가 발생합니다.
안되지 않은 오류 : NO_MODIFICATION_ALLOWED_ERR : DOM 예외 7 ko.bindingHandlers.updateknockout-1.2.1.debug.js : 1577
invokeBindingHandlerknockout-1.2.1.debug.js : 1231
ko.applyBindingsToNode.ko.dependentObservable.
disposeWhenNodeIsRemovedknockout-1.2.1.debug.js : 1268
evaluationknockout-1.2.1.debug.js : 927
ko.dependentObservableknockout-1.2.1.debug.js : 965
ko.applyBindingsToNodeknockout-1.2.1.debug.js : 1252
ko. applyBindingsknockout-1.2.1.debug.js : 1284
ko.utils.arrayForEachknockout-1.2.1.debug.js : 48
ko.applyBindingsknockout-1.2.1.debug.js : 1283
$ .ajax.successPropertyForm : 266
f.extend. _Deferred.e.resolveWithjquery-1.6.2.min.js : 16
wjquery-1.6.2.min.js : 18
f.support.ajax.f.ajaxTransport.send.d
나는 그것이해서는 안되는 항목을 바인딩하는 것을 보지 못합니다. 또한 html에는 선언적 녹아웃 바인딩이 없습니다. 내가 도대체 뭘 잘못하고있는 겁니까?
OMG. 대답은 올바른 바인딩 속성을 사용하는 것이 었습니다. 대신 입력 용 text
이었습니다 value
!
제 경우 문제는 값 대신 텍스트에 데이터 바인딩하는 것입니다.
불량 : <input type = "text"data-bind = "text : id"maxlength = "3"style = "width : 100 %;" />
좋음 : <input type = "text"data-bind = "value : id"maxlength = "3"style = "width : 100 %;" />
실수로 ko.applyBindings(viewModel)
여러 번 전화를 걸었을 때 Chrome에서도이 오류를 보았습니다 .
'ProgramingTip' 카테고리의 다른 글
PHP에서 이중 콜론과 화살표 연산자의 차이점은 무엇입니까? (0) | 2020.12.29 |
---|---|
직선 텍스트 출력을위한 MVC 3 Razor 구문? (0) | 2020.12.29 |
카탈로그, 스키마, 사용자 및 데이터베이스 인스턴스 관계 관계 (0) | 2020.12.29 |
GitHub Api 다운로드 zip 또는 tarball 링크 (0) | 2020.12.29 |
header ()를 사용하여 PHP로 강제 파일 다운로드 (0) | 2020.12.29 |