我有以下代码:
$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();
};
使用以下方法从 View 中调用:
<button ng-click="openPopover($event)"
class="button button-icon icon ion-plus-circled"></button>
所以我无法将模板的 URL 作为参数传递。
请问我该怎么做?
感谢您的任何建议。
最佳答案
我使用以下代码修改解决了它:
// 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();
};
关于angularjs - ionic : popover from template > How to pass param URL dynamically?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27862896/