I want to create a directive for a rich text editor. The rich text editor 
is 
formed of the input area and the toolbar (with buttons for commands, such as
`bold`).

I want to create the toolbar and its buttons dynamically from the 
configuration
that is passed into the rich text editor directive. For example:

<ui-rich-text-editor commands="['bold', 'italic']" ng:model="foo.data" 
ng:maxlength="1000"></ui-rich-text-editor>

In the linking phase, I can evaluate the `commands` attribute on the scope, 
and
generate the element for each command, before appending all of the buttons 
into
the toolbar. However, I begin to have problems when I want my buttons to be 
Angular
directives themselves. If I append custom elements in the linking phase of 
the
rich text editor, they will not be compiled until afterwards. This is an 
issue 
because I need to initialise the toolbar of the rich text editor only when
the buttons have compiled.

Currently, this is what it looks like to initialise our rich text editor:

var scribe = new Scribe(inputElement);
// Toolbar element will add event listeners to all of the buttons inside of 
the
// toolbar
scribe.use(toolbarPlugin(toolbarElement));

How should I design the rich text editor and the directive so that the 
toolbar
can be generated dynamically? Ultimately (after compilation), the rich text
editor might look something like this:

<ui-rich-text-editor commands="['bold', 'italic']" ng:model="foo.data" 
ng:maxlength="1000">
    <ui-rich-text-editor-input 
contenteditable="true"></ui-rich-text-editor-input>
    <ui-rich-text-editor-toolbar>
        <ui-rich-text-editor-toolbar-button 
command="bold">Bold</ui-rich-text-editor-toolbar-button>
        <ui-rich-text-editor-toolbar-button 
command="italic">Italic</ui-rich-text-editor-toolbar-button>
    </ui-rich-text-editor-toolbar>
</ui-rich-text-editor>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to