Angularjs 在Ionic popover中,通过单击将参数传递到范围

Angularjs 在Ionic popover中,通过单击将参数传递到范围,angularjs,ionic,popover,Angularjs,Ionic,Popover,我无法在ionicPopover的范围输入中获取参数变量(范围值)。 范围有问题吗?还是别的什么 [在Controller.js中] .controller('AppCtrl', function(...) { $scope.selectValue = function(rangeVal) { console.log(rangeVal); //print 'undefined' console.log($scope.rangeVal);

我无法在ionicPopover的范围输入中获取参数变量(范围值)。 范围有问题吗?还是别的什么

[在Controller.js中]

.controller('AppCtrl', function(...) {

    $scope.selectValue = function(rangeVal) {
        console.log(rangeVal);         //print 'undefined'
        console.log($scope.rangeVal);  //print 'undefined'
        console.log("hello?");         //print 'hello?'
    };

    $ionicPopover.fromTemplateUrl('templates/popover.html', {
        scope: $scope
    }).then(function(popover) {
        popover.show(".popover");
    });
[在popover.html中]

<ion-popover-view>
    <ion-content>
        <div class="item range">
            <input type="range" name="rangeVal" min="0" max="100" ng-model="rangeVal">
        </div>
        <button ng-click="selectValue({{rangeVal}})">OK</button>
    </ion-content>
</ion-popover-view>

好啊
在[ion popover view]中,我可以观察变量的变化


但是单击后,$scope.selectValue函数无法获取参数……

您不需要花括号以角度调用函数(也不需要将参数传递给该函数):

OK

谢谢,它很管用!我为这个问题感到羞耻:(
<button ng-click="selectValue(rangeVal)">OK</button>