【发布时间】:2015-10-08 15:09:47
【问题描述】:
我无法在 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 函数无法获取参数......
【问题讨论】:
-
谢谢,它有效!我为这个问题感到羞耻:(