Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic : popover from template > How to pass param URL dynamically?

I have following code:

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

Which is called from view using:

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

So i'm not able to pass URL of the template as param.

How can i do it please?

Thanks for any advice.

like image 557
redrom Avatar asked Jan 09 '15 14:01

redrom


1 Answers

I solved it using following code modification:

  // 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();
        };
like image 85
redrom Avatar answered Nov 14 '22 09:11

redrom