繁体   English   中英

如何使用离子(v1)框架呈现弹出viewController?

[英]How to present a popup viewController using ionic (v1) framework?

我正在使用ionic v1实现一个应用程序,即创建一个实用程序.js文件来分隔仅在开发环境中使用的某些功能。 我正在尝试实现一个可以从任何离子视图访问的功能。 我使用的代码是:

myApp.prototype.showAlert = function() {
   var alertPopup = $ionicPopup.alert({
     title: 'Gendalf',
     template: 'You shall not Pass'
   });
 };

这里的离子文档

   // An alert dialog
   $scope.showAlert = function() {
      var alertPopup = $ionicPopup.alert({
        title: 'Don\'t eat that!',
        template: 'It might taste good'
      });

      alertPopup.then(function(res) {
      console.log('Thank you for not eating my delicious ice cream cone');
     });
  };

然后,当您想要显示它时,只需调用方法:

$scope.showAlert();

在示例代码中,您将这样称呼它:

 myApp.showAlert();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM