没有返回值

cordovaDialogs no return value

本文关键字:返回值      更新时间:2023-09-26

我正在尝试运行

$cordovaDialogs.confirm('message', 'title', ['button 1','button 2'])
    .then(function(buttonIndex) {

 $cordovaDialogs.prompt('msg', 'title', ['btn 1','btn 2'], 'default text')
    .then(function(result) {
var input = result.input1;
这里列出的

,但是then回调中的返回值都是undefined。这里有什么想法/修复吗?

我知道你正试图使用$cordovaDialogs,但也许给$ionicPopup一个尝试?我有更好的运气与插件。基本上是一样的。

$ionicPopup.confirm({
     title: 'Consume Ice Cream',
     template: 'Are you sure you want to eat this ice cream?'
   }).then(function(res) {
     if(res) {
       console.log('You are sure');
     } else {
       console.log('You are not sure');
     }
   });

这里是它的文档:https://ionicframework.com/docs/api/service/$ionicPopup/

如果你仍然不能让它工作,评论,我们会解决它。我用过这两个插件,我更喜欢离子弹出