Skip to content

Commit

Permalink
Step 12.21: Implement showPicture method
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha authored and DAB0mB committed Feb 13, 2017
1 parent 13d611a commit f23d9c2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/pages/messages/messages.ts
@@ -1,5 +1,5 @@
import { Component, OnInit, OnDestroy, ElementRef } from '@angular/core';
import { NavParams, PopoverController } from 'ionic-angular';
import { NavParams, PopoverController, ModalController } from 'ionic-angular';
import { Chat, Message, MessageType, Location } from 'api/models';
import { Messages } from 'api/collections';
import { MeteorObservable } from 'meteor-rxjs';
Expand All @@ -9,6 +9,7 @@ import { MessagesOptionsComponent } from './messages-options';
import { Subscription, Observable, Subscriber } from 'rxjs';
import { MessagesAttachmentsComponent } from './messages-attachments';
import { PictureService } from '../../services/picture';
import { ShowPictureComponent } from './show-picture';

@Component({
selector: 'messages-page',
Expand All @@ -31,7 +32,8 @@ export class MessagesPage implements OnInit, OnDestroy {
navParams: NavParams,
private el: ElementRef,
private popoverCtrl: PopoverController,
private pictureService: PictureService
private pictureService: PictureService,
private modalCtrl: ModalController
) {
this.selectedChat = <Chat>navParams.get('chat');
this.title = this.selectedChat.title;
Expand Down Expand Up @@ -266,4 +268,12 @@ export class MessagesPage implements OnInit, OnDestroy {
zoom: Math.min(splitted[2] || 0, 19)
};
}

showPicture({ target }: Event) {
const modal = this.modalCtrl.create(ShowPictureComponent, {
pictureSrc: (<HTMLImageElement>target).src
});

modal.present();
}
}

0 comments on commit f23d9c2

Please sign in to comment.