2015-01-09 10 views
6

Ho seguente codice:Ionico: popover da modello> Come passare param URL in modo dinamico?

$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(); 
     }; 

che viene chiamato da vista utilizzando:

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

quindi non sono in grado di passare URL del modello di come param.

Come posso farlo per favore?

Grazie per qualsiasi consiglio.

risposta

6

ho risolto utilizzando seguente modifica del codice:

// 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

Avete fatto alcun tentativo di utilizzare un "controllore come" la sintassi e capire le ramificazioni di passare in un ambito? – iJames

Problemi correlati