0

I can't get parameter variable(range value) in ionicPopover's range input. Is there any problem in scope? or anything?

[in 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");
    });

[in 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>

in [ion-popover-view] I can watch variable changing

but after click, $scope.selectValue function can't get parameter....

1
  • Thanks, it works! I'm ashamed of this question :( Commented Oct 9, 2015 at 8:03

1 Answer 1

2

you dont need the curly bracers to call a function in angular (neither to pass a parameter to that function):

<button ng-click="selectValue(rangeVal)">OK</button>

Not the answer you're looking for? Browse other questions tagged or ask your own question.