diff --git a/misc/tutorial/106_binding.ngdoc b/misc/tutorial/106_binding.ngdoc index f04bb9536a..8e62a1c797 100644 --- a/misc/tutorial/106_binding.ngdoc +++ b/misc/tutorial/106_binding.ngdoc @@ -28,6 +28,15 @@ For better performance with the following example, you can choose to load the ui app.controller('MainCtrl', function MainCtrl() { var vm = this; + vm.myData = [ + { + 'first-name': 'Cox', + friends: ['friend0'], + address: {street: '301 Dove Ave', city: 'Laurel', zip: '39565'}, + getZip: function() {return this.address.zip;} + } + ]; + vm.gridOptions = { enableSorting: true, columnDefs: [ @@ -36,14 +45,7 @@ For better performance with the following example, you can choose to load the ui { name:'city', field: 'address.city'}, { name:'getZip', field: 'getZip()', enableCellEdit: false} ], - data: [ - { - 'first-name': 'Cox', - friends: ['friend0'], - address: {street: '301 Dove Ave', city: 'Laurel', zip: '39565'}, - getZip: function() {return this.address.zip;} - } - ] + data: '$ctrl.myData' }; }); diff --git a/src/js/core/directives/ui-grid.js b/src/js/core/directives/ui-grid.js index 192a381274..2294d60b0e 100644 --- a/src/js/core/directives/ui-grid.js +++ b/src/js/core/directives/ui-grid.js @@ -84,10 +84,12 @@ // gridUtil.logDebug('dataWatch fired'); var promises = []; - if (angular.isString($scope.uiGrid.data)) { - newData = self.grid.appScope[$scope.uiGrid.data]; - } else { - newData = $scope.uiGrid.data; + if ( self.grid.options.fastWatch ) { + if (angular.isString($scope.uiGrid.data)) { + newData = self.grid.appScope.$eval($scope.uiGrid.data); + } else { + newData = $scope.uiGrid.data; + } } mostRecentData = newData;