Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework 离子用途(项);ReferenceError:未定义useItems_Ionic Framework_Infinite Scroll - Fatal编程技术网

Ionic framework 离子用途(项);ReferenceError:未定义useItems

Ionic framework 离子用途(项);ReferenceError:未定义useItems,ionic-framework,infinite-scroll,Ionic Framework,Infinite Scroll,我在测试是否加载时出错,但在尝试“ReferenceError:useItems未定义”时出错,有人知道问题出在哪里吗 //JS function MyController($scope, $http) { $scope.items = [ {imgsrc: '../img/tgtprofilepic.png', name: 'lala9', address: 'asdasd, Singapore 199123', time:'Open Now (08:00AM - 9:00pm)', fe

我在测试是否加载时出错,但在尝试“ReferenceError:useItems未定义”时出错,有人知道问题出在哪里吗

//JS
function MyController($scope, $http) {


$scope.items = [
{imgsrc: '../img/tgtprofilepic.png', name: 'lala9', address: 'asdasd, Singapore 199123', time:'Open Now (08:00AM - 9:00pm)', featuredimg:'../img/list2.jpg', desc:'asddasdsddsadsadasd' }, 
{imgsrc: '../img/tgtprofilepic.png', name: 'lala10', address: 'asdasd, Singapore 199321', time:'Open Now (08:00AM - 9:00pm)', featuredimg:'../img/list2.jpg', desc:'asddasdsddsadsadasd' }, 
{imgsrc: '../img/tgtprofilepic.png', name: 'lala11', address: 'asdasd, Singapore 199123', time:'Open Now (08:00AM - 9:00pm)', featuredimg:'../img/list2.jpg', desc:'asddasdsddsadsadasd' }];
  $scope.loadMore = function() {
    $http.get('/more-items').success(function(items) {
      useItems(items);
      $scope.$broadcast('scroll.infiniteScrollComplete');
    });
  };

  $scope.$on('$stateChangeSuccess', function() {
    $scope.loadMore();
  });
};

//in html
<div class="list card" ng-repeat="item in items">

        <div class="item item-avatar">
          <img src="{{item.imgsrc}}" alt="">
          <h2>{{{{item.name}}}}</h2>
          <p>{{item.address}}</p>
          <p><span class="operationStatus"></span>{{item.time}}</p>
        </div>

        <div class="item item-body">
          <img class="full-image" src="{{item.featuredimg}}" alt="">
          <p>
            {{item.desc}}
          </p>

        </div>

    </div>
//JS
函数MyController($scope,$http){
$scope.items=[
{imgsrc:'../img/tgtprofilepic.png',名称:'lala9',地址:'asdasd,新加坡199123',时间:'Open Now(08:00AM-9:00pm)',功能DIMG:'../img/list2.jpg',说明:'asddasdasd'},
{imgsrc:'../img/tgtprofilepic.png',名称:'lala10',地址:'asdasd,新加坡199321',时间:'Open Now(08:00AM-9:00pm)',功能DIMG:'../img/list2.jpg',说明:'asddasdasd'},
{imgsrc:'../img/tgtprofilepic.png',名称:'lala11',地址:'asdasd,新加坡199123',时间:'Open Now(08:00AM-9:00pm)',功能DIMG:'../img/list2.jpg',说明:'asddasdasd'}];
$scope.loadMore=函数(){
$http.get(“/more items”).success(函数(items){
使用项目(项目);
$scope.$broadcast('scroll.infiniteScrollComplete');
});
};
$scope.$on(“$stateChangeSuccess”,函数(){
$scope.loadMore();
});
};
//在html中
{{{{item.name}}}}
{{item.address}

{{item.time}

{{item.desc}}


您正在以下代码中调用名为
useItems()
的函数:

$http.get('/more-items').success(function(items) {
      useItems(items);
      $scope.$broadcast('scroll.infiniteScrollComplete');
});

但是,在您发布的代码中没有
useetments()
函数。也许您忘记添加此函数了?

不,我没有useItems函数,实际上我从这里得到了关于此useItems()的操作方法?您是否尝试过从代码中删除useItems()函数,并测试它是否达到了您的目标?您共享的示例代码中有很多函数都不存在,因此您可以自己填充它们。你能分享一下你想用这段代码做什么吗?因为您的控制器中有infiniteScroll的代码,但您似乎没有在HTML中使用它。