我正在使用AngularJS和TinyMCE开发ASP.net MVC应用程序。
我需要向用户显示WYSIWYG textarea以获取输入。
我无法将初始值绑定到textarea中。需要帮忙。以下是我所做的。
<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>
答案 0 :(得分:2)
您肯定想要使用此库: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
}
};
});