TypeError: Cannot read property 'Result' of undefined
<p>I am trying to display results from the database but I am getting this error message </p>

<p><code>TypeError: Cannot read property 'Result' of undefined</code></p>

<p>I am creating a Single Page Application using AngularJS. The Result is at the services.js. Can someone help me to solve this error.</p>

<p>This is my services.js code:</p>

<pre><code>(function () {
'use strict';
/** Service to return the data */

angular.module('MovieApp').
    service('dataService',         // the data service name, can be anything we want
        ['$q',                     // dependency, $q handles promises, the request initially returns a promise, not the data
         '$http',                  // dependency, $http handles the ajax request
         function($q, $http) {     // the parameters must be in the same order as the dependencies

            /*
             * var to hold the data base url
             */
            var urlBase = '/cm0665-assignment/server/index.php';
            var loginUrl = '/cm0665-assignment/server/login.php';

            /*
             * method to retrieve courses, or, more accurately a promise which when
             * fulfilled calls the success method
             */
            this.getCategories = function () {
                var defer = $q.defer(),             // The promise
                    data = {
                        action: 'listCategory',
                        //subject: 'category'
                    };

                $http.get(urlBase, {params: data, cache: true}).                          // notice the dot to start the chain to success()
                    success(function(response){
                        defer.resolve({
                            data: response.ResultSet.Result,         // create data property with value from response
                            rowCount: response.RowCount  // create rowCount property with value from response
                        });
                    }).                                                 // another dot to chain to error()
                    error(function(err){
                        defer.reject(err);
                    });
                // the call to getCourses returns this promise which is fulfilled 
                // by the .get method .success or .failure
                return defer.promise;
            };

            this.getMovies = function (categoryid) {
                var defer = $q.defer(),
                data = {
                    action: 'listFilms',
                    //subject: 'films',
                    category_id: categoryid
                }
                $http.get(urlBase, {params: data, cache: true}).
                        success(function(response){
                            defer.resolve({
                                data: response.ResultSet.Result,
                                rowCount: response.RowCount
                            });
                        }).
                        error(function(err){
                            defer.reject(err);
                        });
                return defer.promise;
            };

            this.getActors = function (filmid) {
                var defer = $q.defer(),
                data = {
                    action: 'listActors',
                    film_id: filmid
                }
                $http.get(urlBase, {params: data, cache: true}).
                        success(function(response){
                            defer.resolve({
                                data: response.ResultSet.Result,
                                rowCount: response.RowCount
                            });
                        }).
                        error(function(err){
                            defer.reject(err);
                        });
                return defer.promise;
            };

            this.getAllMovie = function () {
                var defer = $q.defer(),
                data = {
                    action: 'listFilms'
                }
                $http.get(urlBase, {params: data, cache: true}).
                        success(function(response){
                            defer.resolve({
                                data: response.ResultSet.Result,
                                rowCount: response.RowCount
                            });
                        }).
                        error(function(err){
                            defer.reject(err);
                        });
                return defer.promise;
            };

            this.getSearchResult = function () {
                var defer = $q.defer(),
                data = {
                    action: 'search',
                    // term: terms
                }
                $http.get(urlBase, {params: data, cache: true}).
                        success(function(response){
                            defer.resolve({
                                data: response.ResultSet.Result,
                                rowCount: response.RowCount
                            });
                        }).
                        error(function(err){
                            defer.reject(err);
                        });
                return defer.promise;
            };

            this.login = function (userID, passwd) {
                var defer = $q.defer(),
                data = {
                  //action: 'loginRob',
                  userid: userID,
                  password: passwd
                };

                $http.post(loginUrl, data). // notice the dot to start the chain to success()
                    success(function (response) {
                        defer.resolve({
                            data: response.status, // create data property with value from response
                            result: response,
                            user: response.username
                        });
                        console.log(response);
                    }). // another dot to chain to error()

                    error(function (err) {
                        defer.reject(err);
                    });
                return defer.promise;
            };

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

<p>Each line of the of the ResultSet is showing this error. This means each time i click on other navigation tab i am showing this error message. I really need someone help on this. Thank you in advance.</p>