diff --git a/app/pages/gallery/gallery.html b/app/pages/gallery/gallery.html index 9a58353..c373ec7 100644 --- a/app/pages/gallery/gallery.html +++ b/app/pages/gallery/gallery.html @@ -6,13 +6,12 @@ - - + - + - + diff --git a/app/pages/gallery/gallery.ts b/app/pages/gallery/gallery.ts index 12bf429..abd63a4 100644 --- a/app/pages/gallery/gallery.ts +++ b/app/pages/gallery/gallery.ts @@ -7,27 +7,29 @@ import { NavController, NavParams } from 'ionic-angular'; export class GalleryPage { private images: Array; - private rows: Array>; + private grid: Array>; constructor(private _navCtrl: NavController, private _navParams: NavParams) { this.images = this._navParams.get('images'); - this.rows = Array(Math.ceil(this.images.length/2)); + this.grid = Array(Math.ceil(this.images.length/2)); } ionViewLoaded() { - var rowNum = 0; + let rowNum = 0; - for (var i = 0; i < this.images.length; i+=2) { - this.rows[rowNum] = Array(2); + for (let i = 0; i < this.images.length; i+=2) { + + this.grid[rowNum] = Array(2); + if (this.images[i]) { - this.rows[rowNum][0] = this.images[i] + this.grid[rowNum][0] = this.images[i] } + if (this.images[i+1]) { - this.rows[rowNum][1] = this.images[i+1] + this.grid[rowNum][1] = this.images[i+1] } - rowNum++; } diff --git a/app/pages/home/home.html b/app/pages/home/home.html index cd174f5..cbd63cf 100644 --- a/app/pages/home/home.html +++ b/app/pages/home/home.html @@ -8,7 +8,7 @@ diff --git a/app/pages/home/home.ts b/app/pages/home/home.ts index 99a9b66..7d4e38c 100644 --- a/app/pages/home/home.ts +++ b/app/pages/home/home.ts @@ -1,7 +1,5 @@ import {Component} from '@angular/core'; import {NavController} from 'ionic-angular'; -import { ImagePicker } from 'ionic-native'; -import {GalleryPage} from '../gallery/gallery'; @Component({ templateUrl: 'build/pages/home/home.html' @@ -9,23 +7,6 @@ import {GalleryPage} from '../gallery/gallery'; export class HomePage { - constructor(private _navCtrl: NavController) { - - } - - private openGallery (): void { - let options = { - maximumImagesCount: 8, - width: 500, - height: 500, - quality: 75 - } - - ImagePicker.getPictures(options).then( - file_uris => this._navCtrl.push(GalleryPage, {images: file_uris}), - err => console.log('uh oh') - ); - } + constructor(private _navCtrl: NavController) {} } -