Search code examples
javascriptangularjstextangular

Text angular doesnt load the cell borders in angularjs


I would like to be able to display a table with cell borders in a text angular div.

The content renders but the cell border doesnt

markup

<div ng-app="test">
    <div ng-controller="testController">
        <div text-angular name="testEditor" ng-model="htmlContent"></div>
    </div>
</div>

controller code

angular.module('test', ['textAngular'])

.controller('testController',

function($scope, $timeout, textAngularManager) {
    $scope.htmlContent = undefined;
    //$scope.htmlContent = '<p>Hello There!</p>';

    $timeout(function () {
        $scope.htmlContent = "<table><tr><td style ='border: 1px solid black'>aaaa</td><td style ='border: 1px solid black'>dddddd</td></tr><tr><td style ='border: 1px solid black'>fffff</td><td style ='border: 1px solid black'>ffffffff</td></tr></table>";
        //textAngularManager.refreshEditor('testEditor');
    }, 1000);

});

This is demonstrated at -> http://jsfiddle.net/x20mfq44/

However if i render the html in a separate jsfiddle without text angular, the cell borders show up fine.

<table>
<tr>
    <td style ='border: 1px solid black'>aaaa</td>
    <td style ='border: 1px solid black'>dddddd</td>
</tr>
<tr>
    <td style ='border: 1px solid black'>fffff</td>
    <td style ='border: 1px solid black'>ffffffff</td>
</tr>
</table>

https://jsfiddle.net/1xhfLpmq/


Solution

  • Are you using angular-sanitize? That can mess with HTML attrs through ng-model.