Skip to content

Commit

Permalink
fix(module: modal): fix func call error. (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guoyuanqiang authored and fisherspy committed Aug 22, 2019
1 parent dd46ba3 commit 53cde92
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions components/modal/modal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,16 @@ export class ModalService extends PopupService {
options.placeholders = placeholders;
(options.type = type ? type : 'default'), (options.platform = platform ? platform : 'ios');

function getArgs(self, func) {
const text = self.modalRef.instance.data.text || options.defaultValue[0];
const password = self.modalRef.instance.data.password || options.defaultValue[1];
function getArgs(self: any, func: any) {
let text: any, password: any;
if (self.modalRef) {
text = self.modalRef.instance.data.text || options.defaultValue[0];
password = self.modalRef.instance.data.password || options.defaultValue[1];
} else {
text = options.defaultValue[0];
password = options.defaultValue[1];
}

if (type === 'login-password') {
return func(text, password);
} else if (type === 'secure-text') {
Expand All @@ -143,13 +150,12 @@ export class ModalService extends PopupService {

let actions;
if (typeof callbackOrActions === 'function') {
const onPress = getArgs(this, callbackOrActions);
actions = [
{ text: 'Cancel' },
{
text: 'OK',
onPress: () => {
onPress.call();
getArgs(this, callbackOrActions);
}
}
];
Expand Down

0 comments on commit 53cde92

Please sign in to comment.