Angular 2 ng-class在IE 11中不起作用

时间:2016-10-08 13:41:37

标签: angular angular-ng-class

我正在使用角度2 ngClass来禁用锚标记,这在谷歌浏览器中有效但在IE 11中无效。是否有任何人遇到类似的问题?

<div id ="fileList" class="panel-body collapse in">
            <div class="table-responsive">
                     <table id="uploadInvoice" class="table table-bordered table-condensed">
                    <thead class ="thead">
                    <tr>
                        <th class="gridHeader sortable order1" style="display:none;">File ID</th>
                        <th class="gridHeader sortable">File Name</th>
                        <th class="gridHeader sortable">Upload Status</th>
                        <th class="gridHeader sortable">Uploaded Date</th>
                        <th class="gridHeader sortable">Updated Date</th>
                        <th class="gridHeader sortable">Uploaded BY</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr *ngFor="let file of fileList">
                        <td style="display:none;">{{file.id}}</td>
                        <td><a  href="#fileList" data-toggle="collapse" [ngClass]="{'disabled':file.fileStatus == 'VALIDATING'}" 
                        (click) ="getValidationSummary(file.id,file.fileName)">{{file.fileName}}</a></td>
                        <td>{{file.fileStatus}}</td>
                        <td>{{file.createdDate}}</td>
                        <td>{{file.modifiedDate}}</td>
                        <td>{{file.createdBy}}</td>                                      
                    </tr>
                    </tbody>
                </table>

                </div>
            </div>
        </div>

2 个答案:

答案 0 :(得分:2)

我通过使用* ngIf而不是ngClass来解决它。

 <div id="fileList" class="panel-body collapse in">
                            <div class="table-responsive">
                                <table id="uploadInvoice"
                                    class="table table-bordered table-condensed">
                                    <thead class="thead">
                                        <tr>
                                            <th class="gridHeader sortable order1" style="display: none;">File
                                                ID</th>
                                            <th class="gridHeader sortable">File Name</th>
                                            <th class="gridHeader sortable">Upload Status</th>
                                            <th class="gridHeader sortable">Uploaded Date</th>
                                            <th class="gridHeader sortable">Updated Date</th>
                                            <th class="gridHeader sortable">Uploaded BY</th>
                                            <th class="gridHeader sortable ">Comments</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr *ngFor="let file of fileList">
                                            <td style="display: none;">{{file.id}}</td>
                                            <td
                                                *ngIf="(file.fileStatus != 'PROCESSED' && file.fileStatus != 'ERRORED')">{{file.fileName}}</td>
                                            <td
                                                *ngIf="(file.fileStatus == 'PROCESSED' ||  file.fileStatus == 'ERRORED'    )"><a
                                                href="#fileList" data-toggle="collapse"
                                                (click)="getValidationSummary(file.id,file.fileName)">{{file.fileName}}</a></td>
                                            <td>{{file.fileStatus}}</td>
                                            <td>{{file.createdDate}}</td>
                                            <td>{{file.modifiedDate}}</td>
                                            <td>{{file.createdBy}}</td>
                                            <td><span class="wrappingData">{{ file.comments }}</span></td>
                                        </tr>
                                    </tbody>
                                </table>

                            </div>
                        </div>

答案 1 :(得分:-1)

您应该为'classList'添加一个polyfill,在IE 11中存在一个小问题。 选中-https://www.npmjs.com/package/classlist-polyfill