【问题标题】:Binding value into TinyMCE <textarea> using AngularJS model使用 AngularJS 模型将值绑定到 TinyMCE <textarea>
【发布时间】:2014-08-13 11:15:49
【问题描述】:

我正在使用 AngularJS 和 TinyMCE 开发一个 ASP.net MVC 应用程序。

我需要向用户显示一个所见即所得的文本区域以获取输入。

我无法将初始值绑定到文本区域。需要帮忙。以下是我所做的。

<script type="text/javascript">
    tinyMCE.init({
        mode: "textareas",
        theme: "advanced",
        theme_advanced_path: false,
        theme_advanced_buttons1: "fontselect,|,bold,italic,underline,|,fontsizeselect,|,forecolor,backcolor",
        theme_advanced_buttons2: "|,justifyleft,justifycenter,justifyright,|,link,unlink,|,bullist,numlist,|,code",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "bottom",
        theme_advanced_resizing: true,
    });
</script>

查看:

<textarea data-ng-model="selectedProduct.ProductText">
  {{selectedProduct.ProductText}}
</textarea>

【问题讨论】:

    标签: angularjs tinymce tinymce-3


    【解决方案1】:

    你肯定想使用这个库:https://github.com/angular-ui/ui-tinymce 事情变得容易得多。一个样本:

    <textarea ui-tinymce="tinymceOptions" ng-model="tinymceModel"></textarea>
    
    myAppModule.controller('MyController', function($scope) {
        $scope.tinymceOptions = {
                //enter any options here
            }
        };
    });
    

    【讨论】:

    猜你喜欢
    • 2015-06-28
    • 1970-01-01
    • 2013-11-29
    • 2015-06-21
    • 2017-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-09
    相关资源
    最近更新 更多