Skip to content

Instantly share code, notes, and snippets.

@justinramel
Created December 24, 2015 14:13
Show Gist options
  • Save justinramel/53110a1b609648fbe5d5 to your computer and use it in GitHub Desktop.
Save justinramel/53110a1b609648fbe5d5 to your computer and use it in GitHub Desktop.
ionic 2 blog series input-modal.js
import {Page, Modal, NavParams} from 'ionic/ionic';
import {RatesService} from './rates.service';
@Page({
templateUrl: 'app/rates/input-modal.html',
providers: [RatesService]
})
export class InputModal {
constructor(modal: Modal, params: NavParams, rates: RatesService) {
this.modal = modal;
this.rates = rates;
this.rate = rates.create(params.get('direction'));
}
save(rate) {
this.rates.save(rate).then(rate => {
this.close();
});
}
close() {
let modal = this.modal.get();
if (modal) {
setTimeout(() => { modal.close(); }, 600);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment