diff --git a/CHANGELOG.md b/CHANGELOG.md index 788e346dee..771d2fcf13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ + +## [3.1.1](https://github.com/driftyco/ionic/compare/v3.1.0...v3.1.1) (2017-04-28) + + +### Bug Fixes + +* **datetime:** return the correct value ([af394b5](https://github.com/driftyco/ionic/commit/af394b5)) +* **datetime:** always returns a string ([6677d80](https://github.com/driftyco/ionic/commit/6677d80)) +* **input:** don't dispatch first ngModel update ([505d27a](https://github.com/driftyco/ionic/commit/505d27a)) +* **input:** initialize in ngAfterContentInit ([239b559](https://github.com/driftyco/ionic/commit/239b559)) +* **menu:** missing output events in interface ([7eb2f0b](https://github.com/driftyco/ionic/commit/7eb2f0b)), closes [#11383](https://github.com/driftyco/ionic/issues/11383) +* **range:** fix label reference ([ee6c481](https://github.com/driftyco/ionic/commit/ee6c481)) +* **searchbar:** add setFocus() back ([9264a04](https://github.com/driftyco/ionic/commit/9264a04)), closes [#11397](https://github.com/driftyco/ionic/issues/11397) +* **select:** use correct assert condition ([ec2a34d](https://github.com/driftyco/ionic/commit/ec2a34d)) +* **select:** return the value in ionChange instead of this ([d24c4f4](https://github.com/driftyco/ionic/commit/d24c4f4)) +* **select:** allow object as value ([4c8efc2](https://github.com/driftyco/ionic/commit/4c8efc2)) +* **select:** remove private reference ([c0276d5](https://github.com/driftyco/ionic/commit/c0276d5)) +* **toggle:** initialize in ngAfterContentInit ([539901d](https://github.com/driftyco/ionic/commit/539901d)) + + + # [3.1.0](https://github.com/driftyco/ionic/compare/v3.0.1...v3.1.0) (2017-04-26) @@ -20,7 +41,7 @@ Update your package.json to match the following dependencies, remove the existin "@ionic-native/splash-screen": "3.4.2", "@ionic-native/status-bar": "3.4.2", "@ionic/storage": "2.0.1", - "ionic-angular": "3.1.0", + "ionic-angular": "3.1.1", "ionicons": "3.0.0", "rxjs": "5.1.1", "sw-toolbox": "3.4.0", diff --git a/package.json b/package.json index 7e14dc124a..3435c47b14 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "ionic2", - "version": "3.1.0", + "version": "3.1.1", "description": "A powerful framework for building mobile and progressive web apps with JavaScript and Angular 2", "keywords": [ "ionic", diff --git a/scripts/gulp/tasks/e2e.prod.ts b/scripts/gulp/tasks/e2e.prod.ts index c9bd259a28..a6d9af39fa 100644 --- a/scripts/gulp/tasks/e2e.prod.ts +++ b/scripts/gulp/tasks/e2e.prod.ts @@ -1,3 +1,4 @@ +import { spawn } from 'child_process'; import { accessSync, readFileSync, writeFileSync } from 'fs'; import { dirname, join, relative } from 'path'; @@ -9,7 +10,7 @@ import * as runSequence from 'run-sequence'; import { argv } from 'yargs'; -import { ES_2015, PROJECT_ROOT, SRC_ROOT, SRC_COMPONENTS_ROOT, SCRIPTS_ROOT } from '../constants'; +import { DIST_E2E_COMPONENTS_ROOT, ES_2015, PROJECT_ROOT, SRC_ROOT, SRC_COMPONENTS_ROOT, SCRIPTS_ROOT } from '../constants'; import { createTempTsConfig, createTimestamp, getFolderInfo, readFileAsync, runAppScriptsBuild, writeFileAsync, writePolyfills } from '../util'; import * as pAll from 'p-all'; @@ -240,3 +241,22 @@ task('e2e.polyfill', (done: Function) => { done(err); }); }); + +task('e2e.openProd', (done: Function) => { + runSequence('e2e.prod', 'e2e.open', (err: any) => done(err)); +}); + +task('e2e.open', (done: Function) => { + const folderInfo = getFolderInfo(); + if (folderInfo && folderInfo.componentName && folderInfo.componentTest) { + const filePath = `${folderInfo.componentName}/test/${folderInfo.componentTest}/www/index.html`; + const fullPath = join(DIST_E2E_COMPONENTS_ROOT, filePath); + const spawnedCommand = spawn('open', [fullPath]); + + spawnedCommand.on('close', (code: number) => { + done(); + }); + } else { + console.log(`Can't open without folder argument.`); + } +}); diff --git a/src/components/app/menu-interface.ts b/src/components/app/menu-interface.ts index 45384961fe..1d3d011f03 100644 --- a/src/components/app/menu-interface.ts +++ b/src/components/app/menu-interface.ts @@ -1,7 +1,9 @@ +import { EventEmitter } from '@angular/core'; import { Animation } from '../../animations/animation'; import { Side } from '../../util/util'; export interface Menu { + setOpen(shouldOpen: boolean, animated: boolean): Promise; open(): Promise; close(): Promise; @@ -13,6 +15,11 @@ export interface Menu { side: Side; id: string; isRightSide: boolean; + + ionDrag: EventEmitter; + ionOpen: EventEmitter; + ionClose: EventEmitter; + isAnimating(): boolean; width(): number; getContentElement(): HTMLElement; diff --git a/src/components/checkbox/checkbox.ts b/src/components/checkbox/checkbox.ts index 9107765279..102a023d78 100644 --- a/src/components/checkbox/checkbox.ts +++ b/src/components/checkbox/checkbox.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, HostListener, Input, OnDestroy, Optional, Renderer, ViewEncapsulation } from '@angular/core'; +import { ChangeDetectorRef, Component, ElementRef, HostListener, Input, OnDestroy, Optional, Renderer, ViewEncapsulation } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { Config } from '../../config/config'; @@ -66,7 +66,7 @@ import { Item } from '../item/item'; providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: Checkbox, multi: true } ], encapsulation: ViewEncapsulation.None, }) -export class Checkbox extends BaseInput implements IonicTapInput, AfterViewInit, OnDestroy { +export class Checkbox extends BaseInput implements IonicTapInput, OnDestroy { /** * @input {boolean} If true, the element is selected. diff --git a/src/components/datetime/datetime.ts b/src/components/datetime/datetime.ts index aa5a65799a..d9e385c1cf 100644 --- a/src/components/datetime/datetime.ts +++ b/src/components/datetime/datetime.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component, ElementRef, EventEmitter, HostListener, Input, OnDestroy, Optional, Output, Renderer, ViewEncapsulation } from '@angular/core'; +import { AfterContentInit, Component, ElementRef, EventEmitter, HostListener, Input, OnDestroy, Optional, Output, Renderer, ViewEncapsulation } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { Config } from '../../config/config'; @@ -9,7 +9,7 @@ import { Form } from '../../util/form'; import { BaseInput } from '../../util/base-input'; import { Item } from '../item/item'; import { deepCopy, isBlank, isPresent, isArray, isString, assert, clamp } from '../../util/util'; -import { dateValueRange, renderDateTime, renderTextFormat, convertFormatToKey, getValueFromFormat, parseTemplate, parseDate, updateDate, DateTimeData, daysInMonth, dateSortValue, dateDataSortValue, LocaleData } from '../../util/datetime-util'; +import { dateValueRange, renderDateTime, renderTextFormat, convertDataToISO, convertFormatToKey, getValueFromFormat, parseTemplate, parseDate, updateDate, DateTimeData, daysInMonth, dateSortValue, dateDataSortValue, LocaleData } from '../../util/datetime-util'; /** * @name DateTime @@ -267,7 +267,7 @@ import { dateValueRange, renderDateTime, renderTextFormat, convertFormatToKey, g providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: DateTime, multi: true } ], encapsulation: ViewEncapsulation.None, }) -export class DateTime extends BaseInput implements AfterViewInit, ControlValueAccessor, OnDestroy { +export class DateTime extends BaseInput implements AfterContentInit, ControlValueAccessor, OnDestroy { _text: string = ''; _min: DateTimeData; @@ -425,7 +425,7 @@ export class DateTime extends BaseInput implements AfterViewInit, /** * @hidden */ - ngAfterViewInit() { + ngAfterContentInit() { // first see if locale names were provided in the inputs // then check to see if they're in the config // if neither were provided then it will use default English names @@ -436,13 +436,6 @@ export class DateTime extends BaseInput implements AfterViewInit, this._initialize(); } - /** - * @hidden - */ - _inputUpdated() { - this.updateText(); - } - /** * @hidden */ @@ -451,6 +444,13 @@ export class DateTime extends BaseInput implements AfterViewInit, return this._value; } + /** + * @hidden + */ + _inputUpdated() { + this.updateText(); + } + /** * @hidden */ @@ -458,6 +458,21 @@ export class DateTime extends BaseInput implements AfterViewInit, return true; } + /** + * TODO: REMOVE THIS + * @hidden + */ + _inputChangeEvent(): any { + return this.value; + } + + /** + * @hidden + */ + _inputNgModelEvent(): any { + return convertDataToISO(this.value); + } + @HostListener('click', ['$event']) _click(ev: UIEvent) { // do not continue if the click event came from a form submit diff --git a/src/components/datetime/test/basic/pages/root-page/root-page.html b/src/components/datetime/test/basic/pages/root-page/root-page.html index b4a83e53b9..a594a3a4c0 100644 --- a/src/components/datetime/test/basic/pages/root-page/root-page.html +++ b/src/components/datetime/test/basic/pages/root-page/root-page.html @@ -109,4 +109,9 @@ + + No displayFormat: {{noFormatDate}} + + + diff --git a/src/components/datetime/test/datetime.spec.ts b/src/components/datetime/test/datetime.spec.ts index 6e2f52d063..802e74d0bd 100644 --- a/src/components/datetime/test/datetime.spec.ts +++ b/src/components/datetime/test/datetime.spec.ts @@ -139,12 +139,45 @@ describe('DateTime', () => { expect(columns[1].options[12].disabled).toEqual(true); }); + + it('should always return a string', () => { + datetime.monthValues = '6,7,8'; + datetime.dayValues = '01,02,03,04,05,06,08,09,10, 11, 12, 13, 31'; + datetime.yearValues = '2014,2015'; + + datetime.registerOnChange((value: string) => { + expect(value).toEqual(jasmine.any(String)); + }); + }); + + it('should return a string when setValue is passed an object', zoned(() => { + const dateTimeData = { + hour: { + text: '12', + value: 12, + }, + minute: { + text: '09', + value: 9, + }, + ampm: { + text: 'pm', + value: 'pm', + }, + }; + + datetime.setValue(dateTimeData); + + datetime.registerOnChange((value: string) => { + expect(value).toEqual(jasmine.any(String)); + }); + })); }); describe('writeValue', () => { it('should updateText with default MMM D, YYYY when no displayFormat or pickerFormat', zoned(() => { - datetime.ngAfterViewInit(); + datetime.ngAfterContentInit(); datetime.writeValue('1994-12-15T13:47:20.789Z'); expect(datetime._text).toEqual('Dec 15, 1994'); @@ -152,7 +185,7 @@ describe('DateTime', () => { it('should updateText with pickerFormat when no displayFormat', zoned(() => { datetime.pickerFormat = 'YYYY'; - datetime.ngAfterViewInit(); + datetime.ngAfterContentInit(); datetime.writeValue('1994-12-15T13:47:20.789Z'); expect(datetime._text).toEqual('1994'); @@ -160,7 +193,7 @@ describe('DateTime', () => { it('should updateText with displayFormat when no pickerFormat', zoned(() => { datetime.displayFormat = 'YYYY'; - datetime.ngAfterViewInit(); + datetime.ngAfterContentInit(); datetime.writeValue('1994-12-15T13:47:20.789Z'); expect(datetime._text).toEqual('1994'); @@ -172,7 +205,7 @@ describe('DateTime', () => { it('should generate with default MMM D, YYYY when no displayFormat or pickerFormat', zoned(() => { datetime.monthShortNames = customLocale.monthShortNames; - datetime.ngAfterViewInit(); + datetime.ngAfterContentInit(); datetime.setValue('1994-12-15T13:47:20.789Z'); datetime.generate(); @@ -186,7 +219,7 @@ describe('DateTime', () => { it('should generate with only displayFormat', zoned(() => { datetime.monthShortNames = customLocale.monthShortNames; - datetime.ngAfterViewInit(); + datetime.ngAfterContentInit(); datetime.displayFormat = 'YYYY'; datetime.setValue('1994-12-15T13:47:20.789Z'); @@ -199,7 +232,7 @@ describe('DateTime', () => { it('should generate with only pickerFormat', zoned(() => { datetime.monthShortNames = customLocale.monthShortNames; - datetime.ngAfterViewInit(); + datetime.ngAfterContentInit(); datetime.pickerFormat = 'YYYY'; datetime.setValue('1994-12-15T13:47:20.789Z'); @@ -212,7 +245,7 @@ describe('DateTime', () => { it('should generate with custom locale short month names from input property', zoned(() => { datetime.monthShortNames = customLocale.monthShortNames; - datetime.ngAfterViewInit(); + datetime.ngAfterContentInit(); datetime.pickerFormat = 'MMM YYYY'; datetime.setValue('1994-12-15T13:47:20.789Z'); @@ -227,7 +260,7 @@ describe('DateTime', () => { it('should generate with custom locale full month names from input property', zoned(() => { datetime.monthNames = customLocale.monthNames; - datetime.ngAfterViewInit(); + datetime.ngAfterContentInit(); datetime.pickerFormat = 'MMMM YYYY'; datetime.setValue('1994-12-15T13:47:20.789Z'); diff --git a/src/components/input/test/basic-form/app/app.component.ts b/src/components/input/test/basic-form/app/app.component.ts new file mode 100644 index 0000000000..dcf2f9e7e7 --- /dev/null +++ b/src/components/input/test/basic-form/app/app.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +import { RootPage } from '../pages/root-page/root-page'; + +@Component({ + template: '' +}) +export class AppComponent { + root = RootPage; +} diff --git a/src/components/input/test/basic-form/app/app.module.ts b/src/components/input/test/basic-form/app/app.module.ts new file mode 100644 index 0000000000..7f76975a26 --- /dev/null +++ b/src/components/input/test/basic-form/app/app.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { IonicApp, IonicModule } from '../../../../..'; + +import { AppComponent } from './app.component'; +import { RootPageModule } from '../pages/root-page/root-page.module'; + +@NgModule({ + declarations: [ + AppComponent + ], + imports: [ + BrowserModule, + IonicModule.forRoot(AppComponent), + RootPageModule + ], + bootstrap: [IonicApp] +}) +export class AppModule {} diff --git a/src/components/input/test/basic-form/app/main.ts b/src/components/input/test/basic-form/app/main.ts new file mode 100644 index 0000000000..6af7a5b2ae --- /dev/null +++ b/src/components/input/test/basic-form/app/main.ts @@ -0,0 +1,5 @@ +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app.module'; + +platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/src/components/input/test/basic-form/pages/root-page/root-page.html b/src/components/input/test/basic-form/pages/root-page/root-page.html new file mode 100644 index 0000000000..157c10d7be --- /dev/null +++ b/src/components/input/test/basic-form/pages/root-page/root-page.html @@ -0,0 +1,59 @@ + + + Basic Form + + + +
+ + + Username + + + + Password + + + + Username + + + + Password + + + + Username + + + + Password + + + + Username + + + + Password + + + + Username + + + + Password + + + + Username + + + + Password + + + +
+
\ No newline at end of file diff --git a/src/components/input/test/basic-form/pages/root-page/root-page.module.ts b/src/components/input/test/basic-form/pages/root-page/root-page.module.ts new file mode 100644 index 0000000000..85fba79181 --- /dev/null +++ b/src/components/input/test/basic-form/pages/root-page/root-page.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { IonicPageModule } from '../../../../../..'; + +import { RootPage } from './root-page'; + +@NgModule({ + declarations: [ + RootPage, + ], + imports: [ + IonicPageModule.forChild(RootPage) + ] +}) +export class RootPageModule {} diff --git a/src/components/input/test/basic-form/pages/root-page/root-page.ts b/src/components/input/test/basic-form/pages/root-page/root-page.ts new file mode 100644 index 0000000000..87356e41d7 --- /dev/null +++ b/src/components/input/test/basic-form/pages/root-page/root-page.ts @@ -0,0 +1,22 @@ +import { Component } from '@angular/core'; + +@Component({ + templateUrl: 'root-page.html' +}) +export class RootPage { + myParam = ''; + minValue = 8; + maxValue = 12; + stepValue = 2; + + myValues = { + value1: 'Dynamic Input', + value2: 'Dynamic Textarea' + }; + + toggleValues() { + this.minValue === 8 ? this.minValue = 4 : this.minValue = 8; + this.maxValue === 12 ? this.maxValue = 20 : this.maxValue = 12; + this.stepValue === 2 ? this.stepValue = 4 : this.stepValue = 2; + } +} diff --git a/src/components/label/label.ios.scss b/src/components/label/label.ios.scss index 8b686b40c0..1b48c6d3d8 100644 --- a/src/components/label/label.ios.scss +++ b/src/components/label/label.ios.scss @@ -3,8 +3,14 @@ // iOS Label // -------------------------------------------------- +/// @prop - Text color of the label by an input, select, or datetime +$label-ios-text-color: unset !default; + +/// @prop - Text color of the stacked/floating label when it is focused +$label-ios-text-color-focused: unset !default; + /// @prop - Margin of the label -$label-ios-margin: $item-ios-padding-top ($item-ios-padding-right / 2) $item-ios-padding-bottom 0 !default; +$label-ios-margin: $item-ios-padding-top ($item-ios-padding-right / 2) $item-ios-padding-bottom 0 !default; // iOS Default Label @@ -18,6 +24,16 @@ $label-ios-margin: $item-ios-padding-top ($item-ios-padding-right / // iOS Default Label Inside An Input/Select Item // -------------------------------------------------- +.item-input .label-ios, +.item-select .label-ios, +.item-datetime .label-ios { + color: $label-ios-text-color; +} + + +// iOS Input By Label +// -------------------------------------------------- + .label-ios + ion-input .text-input, .label-ios + ion-textarea .text-input, .label-ios + .input + .cloned-input { @@ -59,6 +75,11 @@ $label-ios-margin: $item-ios-padding-top ($item-ios-padding-right / margin-bottom: $item-ios-padding-media-bottom - 2; } +.input-has-focus .label-ios[stacked], +.input-has-focus .label-ios[floating] { + color: $label-ios-text-color-focused; +} + // Generate iOS Label colors // -------------------------------------------------- diff --git a/src/components/label/label.md.scss b/src/components/label/label.md.scss index 484e157f91..6276b7d720 100644 --- a/src/components/label/label.md.scss +++ b/src/components/label/label.md.scss @@ -3,10 +3,10 @@ // Material Design Label // -------------------------------------------------- -/// @prop - Text color of the label +/// @prop - Text color of the label by an input, select, or datetime $label-md-text-color: #999 !default; -/// @prop - Text color of the label when it has focused +/// @prop - Text color of the stacked/floating label when it is focused $label-md-text-color-focused: color($colors-md, primary) !default; /// @prop - Margin of the label diff --git a/src/components/label/label.wp.scss b/src/components/label/label.wp.scss index ccb55ddcad..94f2f1c294 100644 --- a/src/components/label/label.wp.scss +++ b/src/components/label/label.wp.scss @@ -3,10 +3,10 @@ // Windows Label // -------------------------------------------------- -/// @prop - Text color of the label +/// @prop - Text color of the label by an input, select, or datetime $label-wp-text-color: #999 !default; -/// @prop - Text color of the label when it has focused +/// @prop - Text color of the stacked/floating label when it is focused $label-wp-text-color-focused: color($colors-wp, primary) !default; diff --git a/src/components/range/range.ts b/src/components/range/range.ts index 64f0ac86b9..ea4dd6b8db 100644 --- a/src/components/range/range.ts +++ b/src/components/range/range.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, Input, OnDestroy, Optional, Renderer, ViewChild, ViewEncapsulation } from '@angular/core'; +import { AfterContentInit, ChangeDetectorRef, Component, ElementRef, Input, OnDestroy, Optional, Renderer, ViewChild, ViewEncapsulation } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { clamp, isTrueProperty } from '../../util/util'; @@ -104,7 +104,7 @@ import { UIEventManager } from '../../gestures/ui-event-manager'; providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: Range, multi: true } ], encapsulation: ViewEncapsulation.None, }) -export class Range extends BaseInput implements AfterViewInit, ControlValueAccessor, OnDestroy { +export class Range extends BaseInput implements AfterContentInit, ControlValueAccessor, OnDestroy { _dual: boolean; _pin: boolean; @@ -266,7 +266,7 @@ export class Range extends BaseInput implements AfterViewInit, ControlValue /** * @hidden */ - ngAfterViewInit() { + ngAfterContentInit() { this._initialize(); // add touchstart/mousedown listeners diff --git a/src/components/searchbar/searchbar.ts b/src/components/searchbar/searchbar.ts index 9d3a0c3185..91b76d24e9 100644 --- a/src/components/searchbar/searchbar.ts +++ b/src/components/searchbar/searchbar.ts @@ -172,15 +172,6 @@ export class Searchbar extends BaseInput { @ViewChild('cancelButton', {read: ElementRef}) _cancelButton: ElementRef; - /** - * @hidden - * After View Checked position the elements - */ - ngAfterViewInit() { - this._initialize(); - this.positionElements(); - } - /** * @hidden * On Initialization check for attributes @@ -196,11 +187,9 @@ export class Searchbar extends BaseInput { * @hidden */ _inputUpdated() { - if (this._searchbarInput) { - var ele = this._searchbarInput.nativeElement; - if (ele) { - ele.value = this.value; - } + const ele = this._searchbarInput.nativeElement; + if (ele) { + ele.value = this.value; } this.positionElements(); } @@ -229,9 +218,6 @@ export class Searchbar extends BaseInput { } positionPlaceholder() { - if (!this._searchbarInput || !this._searchbarIcon) { - return; - } const inputEle = this._searchbarInput.nativeElement; const iconEle = this._searchbarIcon.nativeElement; @@ -265,9 +251,6 @@ export class Searchbar extends BaseInput { * Show the iOS Cancel button on focus, hide it offscreen otherwise */ positionCancelButton() { - if (!this._cancelButton || !this._cancelButton.nativeElement) { - return; - } const showShowCancel = this._isFocus; if (showShowCancel !== this._isCancelVisible) { var cancelStyleEle = this._cancelButton.nativeElement; diff --git a/src/components/searchbar/test/basic/pages/root-page/root-page.html b/src/components/searchbar/test/basic/pages/root-page/root-page.html index 19d9f2a6ad..44d3500c93 100644 --- a/src/components/searchbar/test/basic/pages/root-page/root-page.html +++ b/src/components/searchbar/test/basic/pages/root-page/root-page.html @@ -44,4 +44,10 @@

+ + +
+ +
+ \ No newline at end of file diff --git a/src/components/searchbar/test/basic/pages/root-page/root-page.ts b/src/components/searchbar/test/basic/pages/root-page/root-page.ts index a251e2e4e1..093582aa0b 100644 --- a/src/components/searchbar/test/basic/pages/root-page/root-page.ts +++ b/src/components/searchbar/test/basic/pages/root-page/root-page.ts @@ -13,6 +13,7 @@ export class RootPage { isAutocorrect: string = 'on'; isAutocomplete: string = 'on'; isSpellcheck: boolean = true; + activeTab = ''; constructor(private changeDetectorRef: ChangeDetectorRef) { diff --git a/src/components/segment/segment.ts b/src/components/segment/segment.ts index dcc7db713f..0af6e4805d 100644 --- a/src/components/segment/segment.ts +++ b/src/components/segment/segment.ts @@ -1,8 +1,9 @@ -import { ContentChildren, Directive, ElementRef, Optional, QueryList, Renderer } from '@angular/core'; +import { AfterContentInit, ContentChildren, Directive, ElementRef, Optional, QueryList, Renderer } from '@angular/core'; import { NgControl } from '@angular/forms'; import { Config } from '../../config/config'; import { BaseInput } from '../../util/base-input'; +import { assert } from '../../util/util'; import { SegmentButton } from './segment-button'; /** @@ -67,7 +68,7 @@ import { SegmentButton } from './segment-button'; '[class.segment-disabled]': '_disabled' } }) -export class Segment extends BaseInput { +export class Segment extends BaseInput implements AfterContentInit { /** * @hidden @@ -86,7 +87,7 @@ export class Segment extends BaseInput { /** * @hidden */ - ngAfterViewInit() { + ngAfterContentInit() { this._initialize(); this._buttons.forEach(button => { button.ionSelect.subscribe((selectedButton: any) => this.value = selectedButton.value); @@ -98,12 +99,14 @@ export class Segment extends BaseInput { * Write a new value to the element. */ _inputUpdated() { - if (this._buttons) { - var buttons = this._buttons.toArray(); - var value = this.value; - for (var button of buttons) { - button.isActive = (button.value === value); - } + if (!this._buttons) { + assert(false, 'buttons are undefined'); + return; + } + const buttons = this._buttons.toArray(); + const value = this.value; + for (var button of buttons) { + button.isActive = (button.value === value); } } diff --git a/src/components/select/select.ts b/src/components/select/select.ts index 19da56ae24..61eb75f439 100644 --- a/src/components/select/select.ts +++ b/src/components/select/select.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component, ContentChildren, ElementRef, EventEmitter, Input, HostListener, OnDestroy, Optional, Output, Renderer, QueryList, ViewEncapsulation } from '@angular/core'; +import { Component, ContentChildren, ElementRef, EventEmitter, Input, HostListener, OnDestroy, Optional, Output, Renderer, QueryList, ViewEncapsulation } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { ActionSheet } from '../action-sheet/action-sheet'; @@ -9,7 +9,7 @@ import { Config } from '../../config/config'; import { DeepLinker } from '../../navigation/deep-linker'; import { Form } from '../../util/form'; import { BaseInput } from '../../util/base-input'; -import { isCheckedProperty, isTrueProperty, deepCopy, deepEqual } from '../../util/util'; +import { isCheckedProperty, isTrueProperty, deepCopy, deepEqual, assert } from '../../util/util'; import { Item } from '../item/item'; import { NavController } from '../../navigation/nav-controller'; import { Option } from '../option/option'; @@ -147,13 +147,12 @@ import { SelectPopover, SelectPopoverOption } from './select-popover-component'; providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: Select, multi: true } ], encapsulation: ViewEncapsulation.None, }) -export class Select extends BaseInput implements AfterViewInit, OnDestroy { +export class Select extends BaseInput implements OnDestroy { _multi: boolean = false; _options: QueryList