【发布时间】:2014-10-15 15:31:17
【问题描述】:
我想将滑块集成到我的网站中。我为此使用http://darul75.github.io/ng-slider/。但是我不想为我的滑块使用硬编码的起点和终点。我也不想要一个硬编码的默认值,例如
$scope.value = 1000000;
$scope.options={
from :10,
to : 100,
step : 1,
dimension : " $"
}
在我看来
<input ng-model="value" type="text" id="mySlider1" slider options="options" />
相反,我更喜欢对 options.from/options.to 和 value 使用一个函数。
例如 value 的函数应该是这样的:
function(){
var arrayToPush=[];
for(var i=0;i<$scope.data.length;i++){
arrayToPush.push($scope.data[i].hops[0].total_price.EUR)
}
return arrayToPush.max();
};
请注意,数据来自标准 HTTP 请求并返回一个数组
from和to的函数应该类似。首先,如何将函数分配给 ng-model,其次如何将函数分配给from?
希望你能帮我解决这个问题
【问题讨论】:
标签: angularjs angularjs-scope angular-ngmodel angularjs-ng-model