Skip to content Skip to sidebar Skip to footer

Dynamic Data Added In Custom Tinymce Editor Using Angularjs

I am using anglarjs TinyMCE editor, https://www.tinymce.com/docs/integrations/angularjs/, here, I added custom dropdown button in toolbox, and Its working fine when I used static v

Solution 1:

here is one way to do this:

$scope.customerList = ['Customer 1','Customer 2'];
// first make all the menu items
var menuItems = [];
$scope.customerList.forEach(function(customer, index){
    item = {
        'text': customer,
        onclick: function(){
            alert("Clicked on " + customer);
        }
    };
    menuItems.push(item);
});

$scope.tinymceOptions = {
    plugins: 'link image code',
    toolbar: 'undo redo | bold italic | alignleft aligncenter alignright | code | customDrpdwn',
    setup: function(editor){
        editor.addButton( 'customDrpdwn', {
            text : 'Customers List',
            type: 'menubutton',
            icon : false,
            menu: menuItems // then just add it here
        });
    }
};

Post a Comment for "Dynamic Data Added In Custom Tinymce Editor Using Angularjs"