Skip to content

Commit

Permalink
Step 12.17: Implement the sendLocation message to display the new loc…
Browse files Browse the repository at this point in the history
…ation modal
  • Loading branch information
dotansimha authored and darkbasic committed Jun 13, 2017
1 parent 152699c commit 6cf6af8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/pages/messages/messages-attachments.ts
@@ -1,5 +1,7 @@
import { Component } from '@angular/core';
import { AlertController, Platform, ModalController, ViewController } from 'ionic-angular';
import { NewLocationMessageComponent } from './location-message';
import { MessageType } from 'api/models';

@Component({
selector: 'messages-attachments',
Expand All @@ -12,4 +14,22 @@ export class MessagesAttachmentsComponent {
private viewCtrl: ViewController,
private modelCtrl: ModalController
) {}

sendLocation(): void {
const locationModal = this.modelCtrl.create(NewLocationMessageComponent);
locationModal.onDidDismiss((location) => {
if (!location) {
this.viewCtrl.dismiss();

return;
}

this.viewCtrl.dismiss({
messageType: MessageType.LOCATION,
selectedLocation: location
});
});

locationModal.present();
}
}

0 comments on commit 6cf6af8

Please sign in to comment.