Skip to content

Commit 8a6eef6

Browse files
dotansimhadarkbasic
authored andcommitted
Step 13.23: Implement showPicture method
1 parent a085968 commit 8a6eef6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/pages/messages/messages.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit, OnDestroy, ElementRef } from '@angular/core';
2-
import { NavParams, PopoverController } from 'ionic-angular';
2+
import { NavParams, PopoverController, ModalController } from 'ionic-angular';
33
import { Chat, Message, MessageType, Location } from 'api/models';
44
import { Messages } from 'api/collections';
55
import { MeteorObservable } from 'meteor-rxjs';
@@ -9,6 +9,7 @@ import { MessagesOptionsComponent } from './messages-options';
99
import { Subscription, Observable, Subscriber } from 'rxjs';
1010
import { MessagesAttachmentsComponent } from './messages-attachments';
1111
import { PictureService } from '../../services/picture';
12+
import { ShowPictureComponent } from './show-picture';
1213

1314
@Component({
1415
selector: 'messages-page',
@@ -31,7 +32,8 @@ export class MessagesPage implements OnInit, OnDestroy {
3132
navParams: NavParams,
3233
private el: ElementRef,
3334
private popoverCtrl: PopoverController,
34-
private pictureService: PictureService
35+
private pictureService: PictureService,
36+
private modalCtrl: ModalController
3537
) {
3638
this.selectedChat = <Chat>navParams.get('chat');
3739
this.title = this.selectedChat.title;
@@ -266,4 +268,12 @@ export class MessagesPage implements OnInit, OnDestroy {
266268
zoom: Math.min(splitted[2] || 0, 19)
267269
};
268270
}
271+
272+
showPicture({ target }: Event) {
273+
const modal = this.modalCtrl.create(ShowPictureComponent, {
274+
pictureSrc: (<HTMLImageElement>target).src
275+
});
276+
277+
modal.present();
278+
}
269279
}

0 commit comments

Comments
 (0)