File

src/pill-input/pill.component.ts

Description

Internal component that represents a single pill/selected item

Example

Metadata

selector ibm-pill

Index

Methods
Inputs
Outputs
HostBindings

Inputs

item

ListItem to render

Outputs

remove

emits an empty event when the close button is clicked

$event type: EventEmitter

HostBindings

attr.class
attr.class:
Default value : pill

Methods

Public doRemove
doRemove(ev: )

close button handler

Parameters :
Name Type Optional Description
ev
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);
	}
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""