AngularJS中的ng-class无法与ng-include一起使用

时间:2018-11-21 12:59:52

标签: css angularjs ng-class

我在angularJS中使用带有ng-class的表格作为边框(基于div出现的边框很少)。模板代码如下:

<table  style="border: 1px solid #ddd;" class="table container-margin table-fixed"> 
 <tr>
   <th style="border: 1px solid #ddd;">heading1</th>
   <th style="border: 1px solid #ddd;" ng-repeat="option in options" class="hand-cursor">{{option.text}}</th>
 </tr>

 <tr ng-repeat="row in array">
   <td ng-repeat="col in row track by $index" ng-click="(col.clickable === false) ? null : edit(col.impact, col.option, col.pers)"
     ng-class="{'forTableHeading': (col.type==='tableHeading'), 'perspectiveTitle': (col.type==='perspectiveTitle'), 'shortOrLongTermValue': (col.type==='shortTermValue' || (col.type==='longTermValue')),
            'fieldImpact': (!col.type&& col.field==='impact'), 'fieldDop':(!col.type && col.field==='dop'), 'fieldBlank':(!col.type && col.field==='blank')}">

            <div style="white-space: pre;" ng-if="col.type==='shortTermValue'"  ng-style="getBorderStyle(col.shortTermEffect)">{{col.shortTermEffect}}</div>
            <div style="white-space: pre;" ng-if="col.type==='longTermValue'  ng-style="getBorderStyle(col.shortTermEffect)">{{col.longTermEffect}}</div>
            <div style="display:inline-block;font-style:italic;text-align:center;color:red;" ng-if="col.type==='tableHeading' " class="small">{{col.text}}</div>
            <div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="col.type==='perspectiveTitle'"><b>{{col.title}}***{{description}}***</b></div>
            <div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="!col.type&& col.field==='impact'">{{col.text}}</div>
            <div style="word-wrap: break-word;white-space: pre-wrap !important;" ng-if="!col.type && col.field==='dop'">{{col.text}}</div>
            <div style="white-space: pre !important;" ng-if="!col.type && col.field==='blank'"></div>
        </td>
    </tr>

</table>

我在自己的文件中有CSS类。当我使用同一张表时,

<div ng-include="'aaa.tpl.html'"></div> 

但是,当我将此表与ng-include一起使用时,会看到所有表边框,并且ng-class无法正常工作。有人可以说我在做什么错吗?

0 个答案:

没有答案