UNPKG

ionic-framework

Version:

The ionic-framework package comes with both Javascript and Sass frontend dependencies, located in the root of the package, and a Node API, located in `tooling/`.

73 lines (72 loc) 2.46 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var core_1 = require('angular2/core'); var form_1 = require('../../util/form'); /** * @name Label * @description * Labels describe the data that the user should enter in to an input element. * @usage * ```html * <ion-input> * <ion-label>Username</ion-label> * <input type="text" value=""> * </ion-input> * ``` * * @demo /docs/v2/demos/label/ * @see {@link ../../../../components#inputs Input Component Docs} * @see {@link ../Input Input API Docs} * */ var Label = (function () { function Label(_form, _elementRef, _renderer) { this._form = _form; this._elementRef = _elementRef; this._renderer = _renderer; } /** * @private */ Label.prototype.ngOnInit = function () { if (!this.id) { this.id = 'lbl-' + this._form.nextId(); } }; Object.defineProperty(Label.prototype, "text", { get: function () { return this._elementRef.nativeElement.textContent; }, enumerable: true, configurable: true }); /** * @private * @param {string} add class name */ Label.prototype.addClass = function (className) { this._renderer.setElementClass(this._elementRef.nativeElement, className, true); }; __decorate([ core_1.Input(), __metadata('design:type', String) ], Label.prototype, "id", void 0); Label = __decorate([ core_1.Directive({ selector: 'ion-label', host: { '[attr.id]': 'id' } }), __metadata('design:paramtypes', [form_1.Form, core_1.ElementRef, core_1.Renderer]) ], Label); return Label; })(); exports.Label = Label;