【发布时间】:2017-05-30 08:03:56
【问题描述】:
我有一个工厂用于获取有条件的数据。我想要的是当条件改变时工厂也需要更新。
$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?
-
哈哈明白了。谢谢人