-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Displaying HTML
There are several ways of displaying content from the HTML editor. The best way is using our ta-bind
directive, it functions similarly to the ng-bind-html directive except it allows us to replace certain placeholders when they should be displayed. The difference between this and ng-bind-html is that we remove some depreciated html attributes that the execCommand function adds in and replace them with their css counterparts.
An example of this is our youtube plugin. When you insert a video using the button on the toolbar we insert an img
tag as a placeholder. This allows you to edit the size and placement of the video and when we render the end result with ta-bind
we replace the img
tag with the correct iFrame code to display the video. For an example of how this works have a look at the demo pages.
<div ta-bind ng-model="htmlcontent"></div>
To explain this, ta-bind
; this invokes the ta-bind directive. ng-model="htmlcontent"
this tells the ta-bind directive that the HTML code to display is contained in the $scope.htmlcontent
variable..