typeerror cannot read property 'data' of undefined
<p>This is my JS class. M getting this error and not getting grid values in my UI.</p>

<pre><code>define([
       'angular',
                './module'
            ], function(angular, module){
                'use strict',
                module.controller('userSelectController',[
                    '$scope',
                    '$filter',
                    '$http',
                    'filterStateService',
                    'messageBus',
                    'userDetails',
                    'toasty',
                    function($scope,$filter,$http,filterStateService,messageBus, userDetails, toasty){

                        $scope.onAddUser = function(){
                              messageBus.send(Message.AddUser);
                        };

                        $scope.gridOptions = {
                            rowHeight:60,
                            multiSelect: false,
                            enableColumnMenus:false,
                            enableEdit: false,
                            enableSorting: false,
                            enableFiltering: false,

                            columnDefs: [

                                {
                                    field: 'select',
                                    maxWidth: 30,
                                    headerCellTemplate:'&lt;div&gt;&amp;nbsp;&lt;div&gt;',
                                    headerCellClass: 'grid-header-center',
                                    cellClass: 'grid-data-cell',
                                    cellTemplate: '&lt;div class="inner-data-cell"&gt;&lt;input type="checkbox"&gt;&lt;/div&gt;'

                                },
                                            {
                                    field: 'status',
                                    minWidth: 75,
                                    maxWidth: 150,
                                    displayName: 'Status',
                                    headerCellClass: 'grid-header-center',
                                    cellClass: 'grid-data-cell',
                                    'cellTemplate': '&lt;div class="inner-data-cell"&gt;{{row.entity.registrationStatus}}&lt;/div&gt;'
                                },
                                {
                                    field: 'name',
                                    minWidth: 75,
                                    maxWidth: 150,
                                    displayName: 'Name',
                                    headerCellClass: 'grid-header-center',
                                    cellClass: 'grid-data-cell',
                                    cellTemplate: '&lt;div class="inner-data-cell"&gt;{{row.entity.lastName}},{{row.entity.firstName}}&lt;/div&gt;'
                                },
                                {
                                    field: 'organization',
                                    minWidth: 150,
                                    displayName: 'Org',
                                    headerCellClass: 'grid-header-center',
                                    cellClass: 'grid-data-cell',
                                    cellTemplate: '&lt;div class="inner-data-cell"&gt;{{row.entity.organization}}&lt;/div&gt;'
                                },
                                {
                                    field: 'registratioDate',
                                    minWidth: 150,
                                    displayName: 'Registration Date',
                                    headerCellClass: 'grid-header-center',
                                    cellClass: 'grid-data-cell',
                                    cellTemplate: '&lt;div class="inner-data-cell"&gt;{{row.entity.registeredOn}}&lt;/div&gt;'
                                },
                                {
                                    field: 'lastActive',
                                    minWidth: 220,
                                    displayName: 'Last Active',
                                    headerCellClass: 'grid-header-center',
                                    cellClass: 'grid-data-cell',
                                    cellTemplate: '&lt;div class="inner-data-cell"&gt;{{row.entity.lastActive}}&lt;/div&gt;'
                                },
                                {
                                    field: 'uplaodId',
                                    minWidth: 200,
                                    displayName: 'Upload Id',
                                    headerCellClass: 'grid-header-center',
                                    cellClass: 'grid-data-cell',
                                    cellTemplate: '&lt;div class="inner-data-cell"&gt;NA&lt;/div&gt;'
                                }
                            ],

                            filterOptions: $scope.filterOptions
                        };


                        $scope.filterName = function() {

                            var filterText = $scope.nameFilter;
                            if (filterText != null ) {
                                alert("M not null");
                              $scope.filterOptions.filterText = filterText;
                            } else {
                              $scope.filterOptions.filterText = '';
                            }
                          };


                          $scope.resetSearchQuery =  function() {

                              $scope.query = '';
                              filterStateService.updateSearchQuery($scope.query);

                           };




                          $scope.numberRecordsFound = 0;
                          $scope.$onMessage(Message.NumberOfSearchRecordsChanged, function (event, numberRecordsFound) {

                              $scope.numberRecordsFound = numberRecordsFound;

                           });

                      /*  $scope.filterOnLocation = function(gridOptions) {
                            return (gridOptions.firstName + gridOptions.lastName).indexOf($scope.search) &gt;= 0;
                          };*/

                          var userList = [
                                          {
                                              registrationStatus:'Added',
                                              firstName:'first1',
                                              lastName:'last1',
                                              organization:'org1',
                                              registeredOn:'date1',
                                              lastActive:'date1'
                                          },
                                          {
                                              registrationStatus:'Added',
                                              firstName:'first2',
                                              lastName:'last2',
                                              organization:'org2',
                                              registeredOn:'date2',
                                              lastActive:'date2'
                                          },
                                          {
                                              registrationStatus:'Added',
                                              firstName:'first3',
                                              lastName:'last3',
                                              organization:'org3',
                                              registeredOn:'date3',
                                              lastActive:'date3'
                                          },
                                          {
                                              registrationStatus:'Added',
                                              firstName:'first4',
                                              lastName:'last4',
                                              organization:'org4',
                                              registeredOn:'date4',
                                              lastActive:'date4'
                                          },
                                          {
                                              registrationStatus:'Added',
                                              firstName:'first5',
                                              lastName:'last5',
                                              organization:'org5',
                                              registeredOn:'date5',
                                              lastActive:'date5'
                                          },
                                          {
                                              registrationStatus:'Added',
                                              firstName:'Priyanka',
                                              lastName:'Taneja',
                                              organization:'GE',
                                              registeredOn:'25-JAN-2016 : 12:34 pm',
                                              lastActive:'date5'
                                          }

                                      ];

                        $scope.gridOptions.data = userList;
                        $scope.filterData = function (){
                            $scope.gridOptions.data = $filter('filter')(userList,$scope.searchText, undefined);
                        } 

                }])

            })

            This is my HTML class

            &lt;div ng-controller="userSelectController" class="full-panel-container"&gt;

                &lt;div class="row title-bar"&gt;

                    &lt;!-- Add User --&gt;
                    &lt;div class="div-actions col-sm-4 col-md-3 group1"&gt;
                        &lt;span class="title-text"&gt;Users &amp;nbsp&lt;/span&gt;
                     &lt;button class="btn btn-large btn-icon" title="{{getAddTitle()}}" id="add-user-btn" ng-click="onAddUser()"&gt;
                            &lt;i class="fa fa-plus"&gt;&lt;/i&gt;
                        &lt;/button&gt;
                &lt;button class="btn btn-large btn-icon" title="{{getAddTitle()}}" id="add-user-btn" ng-click="onAddUser()"&gt;
                            &lt;i class="fa fa-cloud-upload fa-lg title-action"&gt; &amp;nbsp&lt;/i&gt;
                        &lt;/button&gt;
                    &lt;/div&gt;

                    &lt;!-- search --&gt;         
                    &lt;div class="col-sm-8 col-md-9 group2 pull-left"&gt;

                    &lt;input title="" type="text" size="50" class="title-search ng-pristine ng-valid" placeholder="Enter search text" ng-change="filterData()" ng-model="searchText"&gt;


                        &lt;i class="fa fa-search fa-lg" style="margin-left: -25px;" title="{{getSearchTitle()}}" ng-if="!query.length"&gt;&lt;/i&gt; 
                          &lt;i class="fa fa-times" style="margin-left: -25px;" title="{{::'title.search.clear' | translate}}" ng-if="query.length" ng-click="resetSearchQuery();"&gt;&lt;/i&gt;

                    &lt;/div&gt;


                     &lt;!--  &lt;div class="hidden"&gt;{{filteredLength = gridData.data.length}}&lt;/div&gt;
                        &lt;div class="no-records" ng-show="!organizationDetailsFilteredList.length"&gt;
                           {{:: 'text.search.no.records' | translate }}
                        &lt;/div&gt; --&gt;
                     &lt;/div&gt;


                &lt;/div&gt;

                &lt;div class="full-panle-body"&gt;
                    &lt;div class="row job-summary-grid" ng-show="!loadingLog"&gt;
                        &lt;div ui-grid="gridOptions" ui-if="gridData.data.length&gt;0" ui-grid-auto-resize ui-grid-cellNav ui-grid-edit ui-grid-resize-columns ui-grid-pinning&gt;&lt;/div&gt;
                    &lt;/div&gt;

                &lt;/div&gt;
</code></pre>

<p>M getting this error and not getting grid values in my UI</p>