2017-07-17 81 views
0

如何在选取列表标题中添加自定义按钮,如in here? 我想在Primeng选取列表标题中添加按钮,但它只将字符串作为标题值。 有没有办法在自动生成的头文件中添加任何模板(HTML)?Primeng - 在选取列表标题中添加按钮

<p-pickList 
    sourceHeader="Available" targetHeader="Selected> 
</p-pickList> 
+0

请添加按钮,可以对你的问题的更详细。你试图达到的目标是什么,你尝试过的是什么,以及你面对的错误。如果您提供代码,请提供一些相关详细信息。享受Stackoverflow :-) – Fabien

回答

-2

你可以扩展对领料单,并在您的扩展模板

import { Component, ElementRef, Input, ViewEncapsulation } from '@angular/core'; 
import { PickList, DomHandler } from 'primeng/primeng'; 
import { ObjectUtils } from 'primeng/components/utils/objectutils'; 

@Component({ 
    selector: 'ex-pick-list', 
    templateUrl: 'pick-list.component.html', 
    styleUrls: ['pick-list.component.scss'], 
    encapsulation: ViewEncapsulation.None 
}) 

export class PickListComponent extends PickList { 

    constructor(el: ElementRef, domHandler: DomHandler, objectUtils: ObjectUtils) { 
     super(el, domHandler, objectUtils); 
    } 

} 

<div class="pick-list-container"> 
    <!-- put the original html from the primeng pick list component "moveRight()" now you can use moveRight from PickList --> 

     <div class="custom-buttons"> 
       <button pButton type="button" (click)="moveRight()" class="ui-[label]="''"></button> 
      </div> 
    </div> 
</div> 
+1

你可以添加一些示例代码? –