bootboxjs 경고에 녹아웃 js 뷰 모델에 액세스하고 싶습니다. 왜 내 코드가 작동하지 않는지 아십니까?부트 박스에서 녹아웃 변수/관찰 변수에 액세스하는 방법
JSfiddle : https://jsfiddle.net/bt2pffcd/1/
단순화 된 코드는 다음과 같습니다
<div class="bootbox">
<input data-bind="textinput: testText"/> Typed:
<label data-bind="text: testText"></label>
</div>
<button data-bind=" click: bootBox">Launch bootbox!</button>
그리고 내 뷰 모델과 applybindings : 내 뷰 모델이 bootbox의 DOM 요소 때문에 요소를 bootbox 적용되지 배운
var ViewModel = function() {
var self = this;
self.testText = ko.observable("Test");
self.bootBox = function() {
bootbox.alert($("div.bootbox").html());
}
}
ko.applyBindings(new ViewModel());
jsfiddle에 오류가 있습니다. 콘솔을 봐 –
나는 그것의 문제 메이커가 여기에 대해 확실하지 않지만 그것을 보았다. – Developerdeveloperdeveloper
나는 knockout과 reordered의 다른 버전으로 당신의 [바이올린] (https://jsfiddle.net/bt2pffcd/2/)을 업데이트했다. 외부 리소스 - 부트 박스 경고의 텍스트 상자가 채워지지 않은 이유는 무엇입니까? – Forty3