Unable to pass argument to http get request in angular js
<p>I'm pretty much new in angular js. What I am trying to do is pass an integer argument to http get request in my controller. This is how my sample code looks like.</p>

<pre><code>(function() {
    angular
        .module('myApp.directory', [])

        .factory('NewsService', function($http) 
        {
            return {
                getallnews: function() {
                    return $http.get('get_all_news_feed.php?page='+pageNumber);
                }
            };
        })

        .factory('NewsFeed', function(directoryService) {
            var NewsFeed = function() {
                this.items = [];
                this.busy = false;
                this.pageNumber = 1;
            };

            NewsFeed.prototype.nextPage = function() {
                if (this.busy) return;
                this.busy = true;

                NewsService.getallnews().success(function(data) {
                    var itemData = data;

                    for (var i = 0; i &lt; itemData.length; i++) {
                        this.items.push(itemData[i]);
                    }

                    this.pageNumber++;
                    this.busy = false;
                }.bind(this));
            };
            return NewsFeed;
        })

        .controller('MyController', function(NewsFeed, NewsService) {
            var inst = this;
            inst.news = new NewsFeed();

        });         
})();
</code></pre>

<p>I am building a news feed app. News is fetched from <code>get_all_news_feed.php</code> page and I want to pass a parameter <code>pageNumber</code> to it. This is while implementing infinte scrolling in angular.</p>

<p>I am getting undefined error. Any ideas?</p>