2017-01-13 147 views
0

我需要一個富文本區域框綁定到淘汰賽observable變量,我試過使用Ckseditor控制,但綁定不起作用,即使我把一個自定義KO綁定的CKSeditor。所以我切換回普通的HTML textarea的,然後我可以看到文本的結合,但它會顯示類似這樣的HTML標記文本 -Ckseditor與淘汰賽js綁定問題

<p>This is the scope</p> 

我想textarea的轉化爲豐富的textarea控制像cks或其他任何人,任何人有任何想法如何做到這一點?

<script src="https://cdn.ckeditor.com/4.5.7/standard/ckeditor.js"></script> 
<div class="form-group"> 
       <label for="Scope">Scope</label> 
        <textarea rows="10" name="Scope" class="form-control input-sm" id="Scope" data-bind="value: Scope"></textarea> 
      </div> 

以下是淘汰賽觀察的變量代碼:

self.Scope = ko.observable("<p>This is the scope</p>"); 

回答

0

在標記文件,我沒有使用數據綁定屬性CKEDITOR textarea的

  CKEDITOR.replace('Scope1'); 
      function GetFormatedTextFromDB(){ 
this.Scope1 = ko.observable($('#Scope1').val("<b>Murugesa Pandian test</b>")); 
}; 
ko.applyBindings(new GetFormatedTextFromDB()); 

//通過您的檢索到的變量爲val函數 Output from script