Skip to content

Commit

Permalink
fix(tutorial): Replacing .success with .then due to angular upgrade.
Browse files Browse the repository at this point in the history
Also, updating usage to look for data under response.data.

fix #6511
  • Loading branch information
Portugal, Marcelo authored and Portugal, Marcelo committed Dec 21, 2017
1 parent 089006f commit 07cbe8a
Show file tree
Hide file tree
Showing 55 changed files with 169 additions and 128 deletions.
6 changes: 3 additions & 3 deletions misc/tutorial/102_sorting.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ columnDef option will cause sorting to be applied after the `cellFilters` are ap
};

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions1.data = data;
$scope.gridOptions2.data = data;
.then(function(response) {
$scope.gridOptions1.data = response.data;
$scope.gridOptions2.data = response.data;
});
}]);
</file>
Expand Down
8 changes: 4 additions & 4 deletions misc/tutorial/103_filtering.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ Refer {@link 321_singleFilter singleFilter tutorial}, it is possible to implemen
};

$http.get('/data/500_complex.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
$scope.gridOptions.data[0].age = -5;

data.forEach( function addDates( row, index ){
response.data.forEach( function addDates( row, index ){
row.mixedDate = new Date();
row.mixedDate.setDate(today.getDate() + ( index % 14 ) );
row.gender = row.gender==='male' ? '1' : '2';
row.gender = row.gender === 'male' ? '1' : '2';
});
});

Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/104_i18n.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ For an example using angular-translate to translate your headers, refer to http:
};

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
</file>
Expand Down
4 changes: 3 additions & 1 deletion misc/tutorial/105_footer.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ You can override the default grid footer template with gridOptions.footerTemplat
};

$http.get('/data/500_complex.json')
.success(function(data) {
.then(function(response) {
var data = response.data;

data.forEach( function(row) {
row.registered = Date.parse(row.registered);
});
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/108_hidden_grids.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ It's all up to you. And if you know a better way then please submit it in an iss
$scope.gridOptions = { };

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
</file>
Expand Down
8 changes: 4 additions & 4 deletions misc/tutorial/109_multiple_grids.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Using multiple grids on a single page
$scope.gridOptions2 = {};

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions1.data = data;
.then(function(response) {
$scope.gridOptions1.data = response.data;
});

$http.get('/data/500.json')
.success(function(data) {
$scope.gridOptions2.data = data;
.then(function(response) {
$scope.gridOptions2.data = response.data;
});
}]);
</file>
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/110_grid_in_modal.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ In a sense this is similar to what the auto-resize feature does, but it only doe
};

$http.get('/data/100.json')
.success(function(data) {
$rootScope.gridOptions.data = data;
.then(function(response) {
$rootScope.gridOptions.data = response.data;
});

$scope.showModal = function() {
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/111_cellClass.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ In this example, we will override the color and background for the first column
};

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
</file>
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/113_adding_and_removing_columns.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def properties), and call the notifyDataChange api to force an update.
}

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
</file>
Expand Down
5 changes: 2 additions & 3 deletions misc/tutorial/114_row_header.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ You can add a row header column, which goes into the left pinned container
};

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions.data = data;
console.log(data)
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
</file>
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/115_headerCellClass.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ set the background and foreground color of the header if the sort direction is A
};

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
</file>
Expand Down
8 changes: 4 additions & 4 deletions misc/tutorial/117_tooltips.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ Tooltips respect the cellFilter, so if you define a cellFilter it will also be u
};

$http.get('/data/100.json')
.success(function(data) {
data.forEach( function setGender( row, index ){
row.gender = row.gender==='male' ? '1' : '2';
.then(function(response) {
response.data.forEach( function setGender( row, index ){
row.gender = row.gender === 'male' ? '1' : '2';
});

$scope.gridOptions.data = data;
$scope.gridOptions.data = response.data;
});
}])
.filter('mapGender', function() {
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/120_RTL.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ The grid supports RTL languages
};

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
</file>
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/121_grid_menu.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ In the meantime, you can override the height to fit with your application in you
};

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
</file>
Expand Down
8 changes: 4 additions & 4 deletions misc/tutorial/122_accessibility.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ You can visualize the accessibility roles that have been applied to the grid usi
angular.extend($scope.paginationGridOptions, $scope.virtualGridOptions);

$http.get('/data/100.json')
.success(function(data) {
data.forEach(setGender);
$scope.virtualGridOptions.data = data;
$scope.paginationGridOptions.data = data;
.then(function(response) {
response.data.forEach(setGender);
$scope.virtualGridOptions.data = response.data;
$scope.paginationGridOptions.data = response.data;
});
}])
.filter('mapGender', function() {
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/190_large_dataset.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Demonstrates the following:

var canceler = $q.defer();
$http.get('/data/10000_complex.json', {timeout: canceler.promise})
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});

$scope.$on('$destroy', function(){
Expand Down
4 changes: 3 additions & 1 deletion misc/tutorial/201_editable.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ $scope.gridOptions.columnDefs = [
};

$http.get('/data/500_complex.json')
.success(function(data) {
.then(function(response) {
var data = response.data;

for(i = 0; i < data.length; i++){
data[i].registered = new Date(data[i].registered);
data[i].gender = data[i].gender==='male' ? 1 : 2;
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/202_cellnav.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ while still allowing the right arrow to be handled by the grid.
];

$http.get('/data/500_complex.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});

$scope.info = {};
Expand Down
8 changes: 4 additions & 4 deletions misc/tutorial/203_pinning.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ It is also possible to disable pinning on column level. Note the 'id' column def
];

$http.get('/data/500_complex.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
</file>
Expand Down Expand Up @@ -87,8 +87,8 @@ Below example will hide Pin Right option from id column [by setting hidePinRight
];

$http.get('/data/500_complex.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
</file>
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/204_column_resizing.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ $scope.gridOptions = {
};

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
</file>
Expand Down
4 changes: 3 additions & 1 deletion misc/tutorial/205_row_editable.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ each save will take 3 seconds to complete. Any row saved with a gender of "male
};

$http.get('/data/500_complex.json')
.success(function(data) {
.then(function(response) {
var data = response.data;

for(i = 0; i < data.length; i++){
data[i].registered = new Date(data[i].registered);
}
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/206_exporting_data.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ In this example we use the native grid menu buttons, and we show both the pdf an
};

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});

}]);
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/208_save_state.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ to something different, and use the restore button to set the grid back the way
};

$http.get('/data/100.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
</file>
Expand Down
4 changes: 3 additions & 1 deletion misc/tutorial/209_grouping.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ function will stop working), and writes them to the console.
};

$http.get('/data/500_complex.json')
.success(function(data) {
.then(function(response) {
var data = response.data;

for ( var i = 0; i < data.length; i++ ){
var registeredDate = new Date( data[i].registered );
data[i].state = data[i].address.state;
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/210_selection.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ auto-selects the first row once the data is loaded.
$scope.gridOptions.multiSelect = true;

$http.get('/data/500_complex.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
$timeout(function() {
if($scope.gridApi.selection.selectRow){
$scope.gridApi.selection.selectRow($scope.gridOptions.data[0]);
Expand Down
4 changes: 2 additions & 2 deletions misc/tutorial/213_auto_resizing.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ To use, include the `'ui.grid.autoResize'` module in your angular app's dependen
];

$http.get('/data/500_complex.json')
.success(function(data) {
$scope.gridOptions.data = data;
.then(function(response) {
$scope.gridOptions.data = response.data;
});

$scope.randomSize = function () {
Expand Down
6 changes: 3 additions & 3 deletions misc/tutorial/214_pagination.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ using {@link 212_infinite_scroll infinite scroll}, which also retrieves data in
}

$http.get('/data/100.json')
.success(function (data) {
$scope.gridOptions1.data = data;
$scope.gridOptions2.data = data;
.then(function (response) {
$scope.gridOptions1.data = response.data;
$scope.gridOptions2.data = response.data;
});
}]);
</file>
Expand Down
4 changes: 3 additions & 1 deletion misc/tutorial/215_treeView.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ are loaded only when that row is expanded. They have a 2 second delay to simula
};

$http.get('/data/500_complex.json')
.success(function(data) {
.then(function(response) {
var data = response.data;

for ( var i = 0; i < data.length; i++ ){
data[i].state = data[i].address.state;
data[i].balance = Number( data[i].balance.slice(1).replace(/,/,'') );
Expand Down

0 comments on commit 07cbe8a

Please sign in to comment.