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 Oct 16, 2017
1 parent a292b78 commit dcb6be8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/pages/messages/messages-attachments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Component } from '@angular/core';
import { ModalController, ViewController } from 'ionic-angular';
import { NewLocationMessageComponent } from './location-message';
import { MessageType } from 'api/models';

@Component({
selector: 'messages-attachments',
Expand All @@ -10,4 +12,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 dcb6be8

Please sign in to comment.