我有以下代码:
$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(); };
<button ng-click="openPopover($event)" class="button button-icon icon ion-plus-circled"></button>
所以我无法将模板的URL作为参数传递.
我该怎么办?
谢谢你的建议.
我使用以下代码修改解决了它:
原文链接:https://www.f2er.com/angularjs/240585.html// 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(); };