# Pass scope variable into popover scope

**URL:** <https://forum.ionicframework.com/t/pass-scope-variable-into-popover-scope/38056>\
**Category:** uncategorized\
**Created:** [November 28, 2015, 11:20am UTC](https://forum.ionicframework.com/t/pass-scope-variable-into-popover-scope/38056 "2015-11-28T11:20:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LouisR](https://avatars.discourse-cdn.com/v4/letter/l/9de053/32.png) [@LouisR](https://forum.ionicframework.com/u/LouisR)\
**Post date:** [November 28, 2015, 11:20am UTC](https://forum.ionicframework.com/t/pass-scope-variable-into-popover-scope/38056/1 "2015-11-28T11:20:02Z")

</div>

Hi

I would like to pass a variable from the view scope ($scope.sort`) into the popover scope. Once set in the popover, the variable 'goes out' of it with no issue though, with code below in`$scope.closeSortPopover`.

I thought the popover scope was the same as the scope of the controller it comes from.  
But it seems it’s not the case.  
Where is the popover scope ?  
If I understand correctly from [here](http://ionicframework.com/docs/api/controller/ionicPopover/) the popover scope is a child of the controller scope. So how can I access it… ?

FYI my popover is a list of `<ion-radio>`s offering different sorting opions for the big list in my main view.

html:

```
<button ng-click="openSortPopover($event, sort)">

```

controllers.js

```
$ionicPopover.fromTemplateUrl('templates/computeSortPopover.html', {
   scope: $scope
}).then(function(popover) {
   $scope.sortPopover = popover;
});
$scope.openSortPopover = function($event, sort) {
   $scope.sortPopover.show($event);
};
$scope.closeSortPopover = function(sort) {
   $scope.sortPopover.hide();
   $scope.sort = sort;
};
```

---

<div class="post-metadata">

**Author:** ![LouisR](https://avatars.discourse-cdn.com/v4/letter/l/9de053/32.png) [@LouisR](https://forum.ionicframework.com/u/LouisR)\
**Post date:** [November 28, 2015, 12:36pm UTC](https://forum.ionicframework.com/t/pass-scope-variable-into-popover-scope/38056/2 "2015-11-28T12:36:22Z")

</div>

It works perfectly if the variable `sort` is within an object:

```
$scope.data = {};
$scope.data.sort = ...

```

instead of just:

```
$scope.sort = ....

```

It seems to be due to javascript protypal inheritance.
