我有工厂用于获取具有条件的数据。我想要的是什么时候换工厂也需要更新。当范围更改时,Angualrjs从工厂获得价值
$scope.format=1;
homefact.get_download_format($scope.format).then(function (response) {
$scope.download = response;
});
//watch scople format
$scope.$watch("format", function (newValue, oldValue) {
if ($scope.format === 1) {
//recall the get_donwload_format here with new value
} else {
//recall the get_donwload_format here with new value
}
});
谢谢!
同时在地方,你想* //这里回顾一下get_donwload_format新的价值。*,那么为什么的if/else? – anoop
哈哈明白了。感谢人 –