var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { Component, ElementRef, Input, Optional, Renderer } from '@angular/core'; import { App } from '../app/app'; import { Config } from '../../config/config'; import { isTrueProperty } from '../../util/util'; import { NavController } from '../../navigation/nav-controller'; import { ToolbarBase } from './toolbar-base'; import { ViewController } from '../../navigation/view-controller'; /** * @name Navbar * @description * Navbar acts as the navigational toolbar, which also comes with a back * button. A navbar can contain a `ion-title`, any number of buttons, * a segment, or a searchbar. Navbars must be placed within an * `` in order for them to be placed above the content. * It's important to note that navbar's are part of the dynamic navigation * stack. If you need a static toolbar, use ion-toolbar. * * @usage * ```html * * * * * * * Page Title * * * * * * * * * ``` * * @demo /docs/demos/src/navbar/ * @see {@link ../../toolbar/Toolbar/ Toolbar API Docs} */ var Navbar = (function (_super) { __extends(Navbar, _super); function Navbar(_app, viewCtrl, navCtrl, config, elementRef, renderer) { var _this = _super.call(this, config, elementRef, renderer) || this; _this._app = _app; _this.navCtrl = navCtrl; /** * @hidden */ _this._hidden = false; /** * @hidden */ _this._hideBb = false; viewCtrl && viewCtrl._setNavbar(_this); _this._bbIcon = config.get('backButtonIcon'); _this._sbPadding = config.getBoolean('statusbarPadding'); _this._backText = config.get('backButtonText', 'Back'); return _this; } Object.defineProperty(Navbar.prototype, "hideBackButton", { /** * @input {boolean} If true, the back button will be hidden. */ get: function () { return this._hideBb; }, set: function (val) { this._hideBb = isTrueProperty(val); }, enumerable: true, configurable: true }); Navbar.prototype.backButtonClick = function (ev) { ev.preventDefault(); ev.stopPropagation(); this.navCtrl && this.navCtrl.pop(null, null); }; /** * Set the text of the Back Button in the Nav Bar. Defaults to "Back". */ Navbar.prototype.setBackButtonText = function (text) { this._backText = text; }; /** * @hidden */ Navbar.prototype.didEnter = function () { try { this._app.setTitle(this.getTitleText()); } catch (e) { console.error(e); } }; /** * @hidden */ Navbar.prototype.setHidden = function (isHidden) { // used to display none/block the navbar this._hidden = isHidden; }; Navbar.decorators = [ { type: Component, args: [{ selector: 'ion-navbar', template: '
' + '' + '' + '' + '' + '
' + '' + '
', host: { '[hidden]': '_hidden', 'class': 'toolbar', '[class.statusbar-padding]': '_sbPadding' } },] }, ]; /** @nocollapse */ Navbar.ctorParameters = function () { return [ { type: App, }, { type: ViewController, decorators: [{ type: Optional },] }, { type: NavController, decorators: [{ type: Optional },] }, { type: Config, }, { type: ElementRef, }, { type: Renderer, }, ]; }; Navbar.propDecorators = { 'hideBackButton': [{ type: Input },], }; return Navbar; }(ToolbarBase)); export { Navbar }; //# sourceMappingURL=navbar.js.map