我试图用微小的-MCE与棱角分明,但我有一些麻烦与$渲染功能的指令。当我更新的模式,呈现$函数不叫。
I'm trying to use tiny-mce with angular, but i have some trouble with the $render function in the directive. When i update the model, the $render function is not call.
下面一个plunkr来说明: http://plnkr.co/edit/Ih1nDq p = preVIEW
Here a plunkr to illustrate: http://plnkr.co/edit/Ih1nDq?p=preview
我不知道,但我认为它可能与角1.2,因为具有角1.1.5,有用 : http://plnkr.co/edit/LXAtHd?p=$p$pview
I'm not sure, but i think it could be related to angular 1.2, because with angular 1.1.5, it works : http://plnkr.co/edit/LXAtHd?p=preview
这是角1.2个bug,或者我错过了什么新的具有角1.2?
Is this a bug of angular 1.2, or did i miss something new with angular 1.2?
推荐答案
这个答案显示,code你在你的指令需要做渲染断火时必要的:
This answer shows code you need in your directive to make render fire off when necessary:
TinyMCE < TextArea>两路与AngularJS
// When your model changes from the outside, use ngModel.$render to update the value in the textarea
ngModel.$render = function () {
textarea.val(ngModel.$viewValue);
};
也比较从角-UI-TinyMCE的这个渲染功能( https://github.com /角度的UI / UI-TinyMCE的)
ngModel.$render = function() {
if (!tinyInstance) {
tinyInstance = tinymce.get(attrs.id);
}
if (tinyInstance) {
tinyInstance.setContent(ngModel.$viewValue || '');
}
Plnkr: http://plnkr.co/edit/04AFkp?p=preVIEW
但是取决于你的DOM加载的时间,您可能需要向上设置你的指令的优先级。 : - )
However depending on the timing of the loading of your DOM you may need to set the priority on your directive upwards. :-)
相关推荐
最新文章