Skip to content

Commit

Permalink
Step 5.4: Create new chat service
Browse files Browse the repository at this point in the history
  • Loading branch information
DAB0mB authored and Dotan Simha committed Nov 23, 2016
1 parent 875e179 commit bee2049
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions client/scripts/services/new-chat.service.js
@@ -0,0 +1,31 @@
import { Service } from 'angular-ecmascript/module-helpers';

import newChatTemplateUrl from '../../templates/new-chat.html';

export default class NewChatService extends Service {
constructor() {
super(...arguments);

this.templateUrl = newChatTemplateUrl;
}

showModal() {
this.scope = this.$rootScope.$new();

this.$ionicModal.fromTemplateUrl(this.templateUrl, {
scope: this.scope
})
.then((modal) => {
this.modal = modal;
this.modal.show();
});
}

hideModal() {
this.scope.$destroy();
this.modal.remove();
}
}

NewChatService.$name = 'NewChat';
NewChatService.$inject = ['$rootScope', '$ionicModal'];

0 comments on commit bee2049

Please sign in to comment.