Angular 4搜索过滤器对象

时间:2018-02-06 13:04:12

标签: angular

我有以下代码

            <div class="doctor-content container-fluid">
                <div class="options">
                    <div class="filter col-md-8">
                        <mat-form-field class="input-filter">
                            <input matInput placeholder="Name" name="name" [(ngModel)]='doctorName'>
                        </mat-form-field>
                        <mat-form-field class="input-filter">
                            <input matInput placeholder="Clinic" name="clinicName" [(ngModel)]='clinicName'>
                        </mat-form-field>
                        <mat-form-field class="input-filter">
                            <input matInput placeholder="Specialization" name="specialization" [(ngModel)]='specialization'>
                        </mat-form-field>
                    </div>
                    <div class="doctor-list">
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th></th>
                                    <th>First Name</th>
                                    <th>Email</th>
                                    <th>Clinic</th>
                                    <th>Specialization</th>
                                </tr> 
                            </thead>
                            <tbody>
                                <tr *ngFor='let list of doctors | filter:doctorName | filter:clinicName | filter:specialization| paginate: { itemsPerPage: 25, currentPage: p }'>
                                    <td class="doctor-image">
                                        <img src="../../assets/images/user_blue.png">
                                    </td>
                                    <td>{{list.firstName}} {{list.lastName}}</td>
                                    <td>&nbsp;</td>
                                    <td>{{list.clinics[0].name}}</td>
                                    <td>{{list.specializations[0].name}}</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

搜索过滤器仅适用于firstName,不适用于诊所名称和专业名称。 谁能帮帮我吗 我正在使用

"ng2-search-filter": "^0.3.1",

1 个答案:

答案 0 :(得分:1)

您必须自己编写或根据需要更改ng2-search-filter,例如

HTML:

Dim mail As New MailMessage
mail.IsBodyHtml = True
mail.Body = "Line one<br>"
mail.Body += "Line Two<br>"
mail.Body += "More Lines"

管:

<tbody>
    <tr *ngFor='let list of doctors | filter: doctorName : clinicName : specialization | paginate: { itemsPerPage: 25, currentPage: p }'>
    <td class="doctor-image">
        <img src="../../assets/images/user_blue.png">
     </td>
    <td>{{list.firstName}} {{list.lastName}}</td>
    <td>&nbsp;</td>
    <td>{{list.clinics[0].name}}</td>
    <td>{{list.specializations[0].name}}</td>
    </tr>

希望它有所帮助。