2

我正在使用 angular 2 ngClass 来禁用锚标记,这在 google chrome 中有效,但在 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>
4

2 回答 2

1

我通过使用 *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>
于 2016-11-22T18:53:39.583 回答
-1

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

于 2020-01-08T10:55:13.207 回答