我希望能够在文本angular div中显示带有单元格边框的表格。

内容呈现但单元格边框不呈现

标记

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


控制器代码

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);

});


这在->
http://jsfiddle.net/x20mfq44/

但是,如果我在没有文本角度的单独的jsfiddle中呈现html,则单元格边框会很好显示。

<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/

最佳答案

您是否正在使用角度消毒?那会通过ng-model与HTML attrs混淆。

09-25 19:22