2015-01-09 5 views
6

私は、コードを次ていますので、私はPARAMとしてテンプレートのURLを渡すことができないんだけどIonic:テンプレートからのpopover> param URLを動的に渡すには?

<button ng-click="openPopover($event)" 
class="button button-icon icon ion-plus-circled"></button> 

を:使用してビューから呼び出され

$ionicPopover.fromTemplateUrl('templates/popover_available_sounds.html', { 
      scope: $scope, 
     }).then(function(popover) { 
      $scope.popover = popover; 
     }); 

     // Display Popover 
     $scope.openPopover = function($event) { 
      $scope.popover.show($event); 
     }; 

     $scope.closePopover = function() { 
      $scope.popover.hide(); 
     }; 

を。

どうすればいいですか?

ありがとうございました。

答えて

6

私は、次のコード変更を使用して、それを解く:

// Display Popover 
     $scope.openPopover = function($event, templateName) { 
      // Init popover on load 
      $ionicPopover.fromTemplateUrl('templates/'+templateName, { 
       scope: $scope, 
      }).then(function(popover) { 
       $scope.popover = popover; 
       $scope.popover.show($event); 
      }); 
     }; 

     $scope.closePopover = function() { 
      $scope.popover.hide(); 
     }; 
+1

あなたは構文「としてコントローラ」を使用してスコープを渡すの波及効果を把握するためにあらゆる努力をしたことがありますか? – iJames

関連する問題