如何制作模型&x27;肮脏';在angularjs?

如何制作模型&x27;肮脏';在angularjs?,angularjs,Angularjs,我正在编写一个降价编辑器 <textarea class="wnd-content-textarea" name="" id="" cols="30" rows="10" ng-model="content" ng-change=""> </textarea> jquery plguin是: 文本区域中的文本在浏览器中已更改,但模型实际上仍然保持不变。我通过在浏览器中输出{{}并在控制台中登录来检查它 此时

我正在编写一个降价编辑器

<textarea class="wnd-content-textarea" 
          name="" id="" cols="30" rows="10" 
          ng-model="content"
          ng-change="">
</textarea>
jquery plguin是:

文本区域中的文本在浏览器中已更改,但模型实际上仍然保持不变。我通过在浏览器中输出
{{}
并在控制台中登录来检查它

此时,如果我在textarea中键入一个空格,那么该插件所做的所有更改都将反映在模型中

我尝试了scope.$apply,这导致了控制台错误。 我还尝试了
$timeout(函数(/*jquery updateing*/){})
,没有任何变化

如何使更改反映在模型上? -把它弄脏? -有什么最佳做法吗


谢谢大家!

你能给我们看更多的代码吗?这已经在别处得到了回答:在stacksnippetmwarren中重现错误,谢谢你让我知道它已经得到了回答。
scope.execEditorCmd = function (cmd) {
  // List of commands:
  // 'cmd-bold', 
  // 'cmd-italic',
  // 'cmd-quote',
  // 'cmd-unorder-list',
  // 'cmd-order-list'

  /**
  * Get selected text in textarea tag. 
  * textrange() is dependent on jquery-textrange plugin
  * @type {Object}
  * e.g.: {position: 4, start: 4, end: 8, length: 4, text: "reqw"}
  */
  var selectedTextObj = $textAreaElement.textrange('get');
  // Execute the string replace command using structure defined before
  var boldedText = selectedTextObj.text
    .replace( markdownCmd[cmd].search , markdownCmd[cmd].replace);

  // Actually replace the orginal text with executed string in textarea.
  // $timeout();

  $textAreaElement.textrange('replace', boldedText);

  // Not sure if it is the right way, but I have to do it to update model. 
  scope.content = $textAreaElement.val();
};