如何将类别ID从onsen-view传递给控制器

时间:2015-06-21 21:36:55

标签: javascript angularjs onsen-ui

我从JSON格式的PHP文件中获取数据,并在视图中“预告”它。

如何将类别ID从视图传递给控制器​​?

查看:

<div ng-controller="listItems">
        <ul class="list">
            <li class="list-group-item" dir-paginate="post in phones | itemsPerPage: 10" total-items="totalUsers" current-page="pagination.current">
                <a href="#" class="list-group-item">
                <img src="/small/{{post.name}}" class="img-rounded col-md-1" alt="">
                <h4 class="list-group-item-heading">{{post.name1}}</h4>
                <p class="list-group-item-text">
                {{post.text1}}</p><div class="clearfix"></div>
              </a>

            </li>
        </ul>

    </div>

Controller JS:

    function getResultsPage(pageNumber) {
        $http.get('/calk.php?page=' + pageNumber + '&cat=' + 'CAT-ID-HERE')
            .then(function(result) {
                $scope.phones = result.data.records;
                $scope.totalUsers = result.data.count
            });
    }
})

0 个答案:

没有答案