我的页面上有一个 WYMeditor 实例,我想使用 AngularJS 控制内部文本的值。
我尝试过但无效的几种方法:
让我们假设:
$scope.Details = 'foo';
它会根据不同的用户操作而变化。
使用 ng 模型:
<textarea ng-model="Details" class="wymeditor"></textarea>
不起作用,因为当我修改Details时,实际textarea的内容会发生变化,但它是隐藏的,并且属于WYMeditor的内部iFrame的内容不会改变。
在我的 Angular 控制器中使用 WYMeditor 的 html() 函数:
wym = jQuery.wymeditors(0); wym.html($scope.Details);
这将返回一条引用 WYMeditor 的 html() 函数声明的错误消息。
Error: this._doc is undefined
我正在使用 WYMeditor 0.5、Angular 1.1.5、jQuery 2.0.3 和 jQuery-migrate 1.2.1(让 WYMeditor 与 jQuery 2 一起工作)。
我想以某种方式将 ng-model="Details" 添加到 iFrame 声明中,但我不知道如何做到这一点,而且似乎有一个更深层次的问题需要解决,就像这样解决。
谢谢!