niana sharma

niana sharma

  • NA
  • 7
  • 10.8k

Loading TinyMCE directive after Angular has finished routing

Mar 14 2019 12:26 AM
am building a small app using Angular JS and Angular UI. I have found the TinyMCE directive in Angular UI really helpful. However, I have now set up routing with Angular, loading partial Jade templates.
 

The JS that configures the TinyMCE is included in this partial view, so it doesn't execute (this makes sense since it is script returned by ajax request). In my controller I tried using:

  1. $scope.$on("$routeChangeSuccess",function(){   
  2. var quotesApp = angular.module('quotesApp', ['ui'], function($routeProvider) {});   
  3. quotesApp.value("ui.config",{   
  4. tinymce: {   
  5. theme: "advanced",   
  6. theme_advanced_buttons1: "undo,redo,|,bold,italic,underline,|,code",   
  7. theme_advanced_buttons2: "",   
  8. theme_advanced_buttons3: "",   
  9. theme_advanced_statusbar_location: "bottom",   
  10. force_p_newlines: false,   
  11. width: 300   
  12. }   
  13. });   
  14. });  
But it doesn't init the TinyMCE.
 

Can anyone point me in the right direction? I have break pointed through, it gets to the TinyMCE init function but I can't see at what point it breaks...https://bit.ly/2VSgyv8