1
如何使用$範圍爲功能
我的代碼和$ scope.products不起作用:
$http.get('catalog/view/theme/default/template/confirm/fetch_product.php').then(function(response){ $scope.products = response.data.records; });
$scope.items = [];
var counter = 0;
$scope.loadMore = function($scope) {
var last = $scope.products.length;
for (var i = 0; i < 10; i++) {
if(counter >= last) { break; }
$scope.items.push($scope.products[counter]);
counter += 1;
}
};
$scope.loadMore();
我做到了我的代碼是現在︰$ scope.loadMore = function(){但仍然我不能使用$ scope.products在函數 –
是啊非常感謝 –