I am developing an ASP.net MVC application with AngularJS and TinyMCE.
我正在使用AngularJS和TinyMCE开发ASP.net MVC应用程序。
I need to display a WYSIWYG textarea to the user to get input.
我需要向用户显示WYSIWYG textarea以获取输入。
I am not able to bind initial value into the textarea. Need help. The following is what I have done.
我无法将初始值绑定到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>
View:
<textarea data-ng-model="selectedProduct.ProductText">
{{selectedProduct.ProductText}}
</textarea>
1 个解决方案
#1
2
You definitely want to use this library: https://github.com/angular-ui/ui-tinymce Things get much easier then. A sample:
你肯定想要使用这个库: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
}
};
});
#1
2
You definitely want to use this library: https://github.com/angular-ui/ui-tinymce Things get much easier then. A sample:
你肯定想要使用这个库: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
}
};
});