2016-09-29 50 views
2

嗨我使用離子創建一個簡單的彈出。這裏我不能在點擊按鈕後顯示彈出信息。我不知道在哪裏,我要去錯了,請幫我在顯示彈出。而即時得到錯誤

ionic.bundle.js:26794 TypeError: Cannot read property 'show' of undefined 
    at Scope.$scope.showPopup 

link

angular.module('CarWash',[$ionic]).controller('popSelect',['$scope',function($scope,$ionicPopup){ 
$scope.data={}; 
$scope.showPopup = function() { 
     $ionicPopup.show({ 
      title:'select car wash', 
      template: "Hello customer !!!", 

     }); 
     alertpop.then(function(res){ 
      console.log('Inside pop-up'); 

回答

0

你在依賴注入搞砸,你必須注入$ionicPopup在控制器工廠功能中使用它。

angular.module('CarWash',[$ionic]) 
.controller('popSelect',['$scope', '$ionicPopup', //<-- injected $ionicPopup here 
    function($scope, $ionicPopup){ //<-- now you can access $ionicPopup instance here. 
+0

非常感謝!它工作! :) – sree

+0

@sree高興地幫助你,謝謝:-) –

+0

我在離子列表中有疑問,你可以幫我嗎。 – sree