How pass category id from onsen-view to controller

117 views Asked by At

I'm getting data from a PHP file in JSON format and "foreached" it in view.

How do I pass the category id from view to controller?

View:

<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

There are 0 answers