Skip to content

Commit

Permalink
Step 7.7: Define component's method to open options
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha authored and DAB0mB committed Dec 24, 2016
1 parent 78dc963 commit c2ed8e1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/pages/messages/messages.ts
@@ -1,9 +1,10 @@
import {Component, OnInit, OnDestroy, ElementRef} from "@angular/core";
import { NavParams } from "ionic-angular";
import { Component, OnInit, OnDestroy, ElementRef } from "@angular/core";
import { NavParams, PopoverController } from "ionic-angular";
import { Chat, Message } from "api/models/whatsapp-models";
import { Messages } from "api/collections/whatsapp-collections";
import { Observable } from "rxjs";
import { MeteorObservable } from "meteor-rxjs";
import { MessagesOptionsComponent } from "../messages-options/messages-options";

@Component({
selector: "messages-page",
Expand All @@ -18,12 +19,21 @@ export class MessagesPage implements OnInit, OnDestroy {
autoScroller: MutationObserver;
senderId: string;

constructor(navParams: NavParams, element: ElementRef) {
constructor(navParams: NavParams, element: ElementRef, public popoverCtrl: PopoverController) {
this.selectedChat = <Chat>navParams.get('chat');
this.title = this.selectedChat.title;
this.picture = this.selectedChat.picture;
this.senderId = Meteor.userId();
}

showOptions(): void {
const popover = this.popoverCtrl.create(MessagesOptionsComponent, {
chat: this.selectedChat
}, {
cssClass: 'options-popover'
});

popover.present();
}

private get messagesPageContent(): Element {
Expand Down

0 comments on commit c2ed8e1

Please sign in to comment.