src/pill-input/pill.component.ts
Internal component that represents a single pill/selected item
| selector | ibm-pill |
Methods |
|
Inputs |
Outputs |
HostBindings |
item
|
ListItem to render |
|
Defined in src/pill-input/pill.component.ts:25
|
|
remove
|
emits an empty event when the close button is clicked $event type: EventEmitter
|
|
Defined in src/pill-input/pill.component.ts:27
|
|
| attr.class |
attr.class:
|
Default value : pill
|
|
Defined in src/pill-input/pill.component.ts:28
|
| Public doRemove | ||||||||
doRemove(ev: )
|
||||||||
|
Defined in src/pill-input/pill.component.ts:30
|
||||||||
|
close button handler
Parameters :
Returns :
void
|
import {
Component,
EventEmitter,
Output,
Input,
HostBinding
} from "@angular/core";
/**
* Internal component that represents a single pill/selected item
* @export
* @class Pill
*/
@Component({
selector: "ibm-pill",
template: `
<span><ng-content></ng-content></span>
<button class="pill_close" (click)="doRemove($event)" type="button">
<ibm-static-icon icon="x" size="sm" classList="close_icon"></ibm-static-icon>
</button>`
})
export class Pill {
/** ListItem to render */
@Input() item;
/** emits an empty event when the close button is clicked */
@Output() remove = new EventEmitter();
@HostBinding("attr.class") attrClass = "pill";
/** close button handler */
public doRemove(ev) {
this.item.selected = false;
ev.stopPropagation();
this.remove.emit(this.item);
}
}