ng-ytl-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
46 lines (40 loc) • 1.1 kB
text/typescript
import { Component, OnInit } from '@angular/core';
import { NzMessageService } from '../../../index.showcase';
({
selector: 'nz-demo-transfer-search',
template: `
<nz-transfer
[nzDataSource]="list"
nzShowSearch
[nzFilterOption]="filterOption"
(nzSearchChange)="search($event)"
(nzSelectChange)="select($event)"
(nzChange)="change($event)">
</nz-transfer>
`
})
export class NzDemoTransferSearchComponent implements OnInit {
list: any[] = [];
ngOnInit() {
for (let i = 0; i < 20; i++) {
this.list.push({
key: i.toString(),
title: `content${i + 1}`,
description: `description of content${i + 1}`,
direction: Math.random() * 2 > 1 ? 'right' : ''
});
}
}
filterOption(inputValue, option) {
return option.description.indexOf(inputValue) > -1;
}
search(ret: any) {
console.log('nzSearchChange', ret);
}
select(ret: any) {
console.log('nzSelectChange', ret);
}
change(ret: any) {
console.log('nzChange', ret);
}
}