1

I am developing an ASP.net MVC application with AngularJS and TinyMCE.

I need to display a WYSIWYG textarea to the user to get input.

I am not able to bind initial value into the textarea. Need help. The following is what I have done.

<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 Answer 1

2

You definitely want to use this library: https://github.com/angular-ui/ui-tinymce Things get much easier then. A sample:

<textarea ui-tinymce="tinymceOptions" ng-model="tinymceModel"></textarea>

myAppModule.controller('MyController', function($scope) {
    $scope.tinymceOptions = {
            //enter any options here
        }
    };
});
Sign up to request clarification or add additional context in comments.

6 Comments

is it a freeware? and I am using TinyMCE version 3.5.8
Good question. Yes it is. The license can be found here: github.com/angular-ui/ui-tinymce/blob/master/LICENSE
It is compatible with version 4+ of TinyMCE, you would have to upgrade then. If you can't or don't want to, I would look at this post: stackoverflow.com/questions/20005699/…
I need help in downloading the library you are mentioning. In the link you provided what file(s) should I download?
This is the only file you need to download: github.com/angular-ui/ui-tinymce/blob/master/src/tinymce.js Add it to your application as dependency: var myAppModule = angular.module('MyApp', ['ui.tinymce'])
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.