Created
December 24, 2015 14:13
-
-
Save justinramel/53110a1b609648fbe5d5 to your computer and use it in GitHub Desktop.
ionic 2 blog series input-modal.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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