http://ionicframework.com/docs/api/controller/ionicPopover/
{object=} scope The scope to be a child of. Default: creates a child of $rootScope.
In you Controller you need to add $rootScope;
.controller('AppCtrl', function($scope , $rootScope, $ionicPopover) {
and then use this for the variable you need to pass on the popover
$rootScope.myvar = "hello";
$scope.myfunction=function(){
var d = new Date();
$rootScope.myvar="some change" + d.getMilliseconds() ;
}
with this the variables will be accessible on the popover from the function
$ionicPopover.fromTemplateUrl('templates/popover.html', function(popover) {
$scope.popover = popover;
});
you can access your variable by popover.scope.$parent.variableName || popover.scope.$root.variableName
<a class="item" href="http://learn.ionicframework.com/" target="_blank">
{{popover.scope.$parent.myvar}}
</a>
I tried to use this for simplicity
$scope.mytest = popover.scope.$parent.myvar ;
console.log( popover);
$scope.popover = popover;
But its not working.
CodePen: