ng2-materialize
Version:
An Angular 2+ wrap around Materialize library
46 lines (45 loc) • 1.67 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var MzChipComponent = (function () {
function MzChipComponent(elementRef) {
this.elementRef = elementRef;
this.chipClass = true;
this.close = false;
this.delete = new core_1.EventEmitter();
}
Object.defineProperty(MzChipComponent.prototype, "chipElement", {
get: function () {
return this.elementRef.nativeElement;
},
enumerable: true,
configurable: true
});
MzChipComponent.prototype.onDelete = function () {
var value = '';
for (var i = 0; i < this.chipElement.childNodes.length; i++) {
if (this.chipElement.childNodes.item(i).nodeType === Node.TEXT_NODE) {
value += this.chipElement.childNodes.item(i).nodeValue;
}
}
this.delete.emit(value.trim());
};
return MzChipComponent;
}());
MzChipComponent.decorators = [
{ type: core_1.Component, args: [{
selector: 'mz-chip',
template: "<ng-content></ng-content><i class=\"close material-icons\" (click)=\"onDelete()\" *ngIf=\"close\">close</i>",
styles: [""],
},] },
];
/** @nocollapse */
MzChipComponent.ctorParameters = function () { return [
{ type: core_1.ElementRef, },
]; };
MzChipComponent.propDecorators = {
'chipClass': [{ type: core_1.HostBinding, args: ['class.chip',] },],
'close': [{ type: core_1.Input },],
'delete': [{ type: core_1.Output },],
};
exports.MzChipComponent = MzChipComponent;