0

After rendering tinyMCE I set the content on the control but the control doesn't bind the $scope variable so I can make changes. $scope.performanceDescription is the content of pdEditor and $scope.instructionsForBuyers is content for ifbEditor. Here's the code

var pdEditor = new tinyMCE.Editor('pd', CONFIG.tinymceOptions, tinyMCE.EditorManager);
    var ifbEditor = new tinyMCE.Editor('ifb', CONFIG.tinymceOptions, tinyMCE.EditorManager);
    pdEditor.render();
    ifbEditor.render();

    $scope.title = performance.Title;
    $scope.category = performance.Category;
    $scope.subCategory = performance.Sub_category;
    $scope.instructionsForBuyers = performance.Instructions_for_buyers;
    $scope.performanceDescription = performance.Description;
    $scope.performanceHours = parseInt(performance.Performance_length / 60);
    $scope.performanceMinutes = performance.Performance_length % 60;
    $scope.minTimeHours = parseInt(performance.Buffer_time / 60);
    $scope.minTimeMinutes = performance.Buffer_time % 60;
    $scope.chosenLanguageTags = generateAutocompleteLanguageTags(performance.Languages_offered);
    $scope.chosenPerformanceTags = generateAutocompletePerformanceTags(performance.Tags);

    pdEditor.setContent($scope.performanceDescription, { format: 'raw'});
    ifbEditor.setContent($scope.instructionsForBuyers, { format: 'raw'});e
  • Are you using tinymce directly in your controller? That's a bad idea. Better look for a directive like https://github.com/angular-ui/ui-tinymce – mainguy Sep 15 '14 at 08:30
  • I use tinyMCE like directive (from the example above). The problem is when I return to a route tinyMCE doesn't show and I have to render it again. When I render the control again, ng-model doesn't bind to the control – Aleksandar Mihajlovski Sep 15 '14 at 08:32
  • Sorry, can't find a tinyMCE directive in your example. Calling new tinyMCE.Editor() is not a directive. It's plain javascript and more jquery style than angularJS. Maybe read this excellent answer http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background – mainguy Sep 15 '14 at 08:41

0 Answers0