Skip to content

Commit 07cbe8a

Browse files
Portugal, MarceloPortugal, Marcelo
Portugal, Marcelo
authored and
Portugal, Marcelo
committed
fix(tutorial): Replacing .success with .then due to angular upgrade.
Also, updating usage to look for data under response.data. fix #6511
1 parent 089006f commit 07cbe8a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+169
-128
lines changed

misc/tutorial/102_sorting.ngdoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ columnDef option will cause sorting to be applied after the `cellFilters` are ap
117117
};
118118

119119
$http.get('/data/100.json')
120-
.success(function(data) {
121-
$scope.gridOptions1.data = data;
122-
$scope.gridOptions2.data = data;
120+
.then(function(response) {
121+
$scope.gridOptions1.data = response.data;
122+
$scope.gridOptions2.data = response.data;
123123
});
124124
}]);
125125
</file>

misc/tutorial/103_filtering.ngdoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ Refer {@link 321_singleFilter singleFilter tutorial}, it is possible to implemen
166166
};
167167

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

173-
data.forEach( function addDates( row, index ){
173+
response.data.forEach( function addDates( row, index ){
174174
row.mixedDate = new Date();
175175
row.mixedDate.setDate(today.getDate() + ( index % 14 ) );
176-
row.gender = row.gender==='male' ? '1' : '2';
176+
row.gender = row.gender === 'male' ? '1' : '2';
177177
});
178178
});
179179

misc/tutorial/104_i18n.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ For an example using angular-translate to translate your headers, refer to http:
3838
};
3939

4040
$http.get('/data/100.json')
41-
.success(function(data) {
42-
$scope.gridOptions.data = data;
41+
.then(function(response) {
42+
$scope.gridOptions.data = response.data;
4343
});
4444
}]);
4545
</file>

misc/tutorial/105_footer.ngdoc

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ You can override the default grid footer template with gridOptions.footerTemplat
6565
};
6666

6767
$http.get('/data/500_complex.json')
68-
.success(function(data) {
68+
.then(function(response) {
69+
var data = response.data;
70+
6971
data.forEach( function(row) {
7072
row.registered = Date.parse(row.registered);
7173
});

misc/tutorial/108_hidden_grids.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ It's all up to you. And if you know a better way then please submit it in an iss
5151
$scope.gridOptions = { };
5252

5353
$http.get('/data/100.json')
54-
.success(function(data) {
55-
$scope.gridOptions.data = data;
54+
.then(function(response) {
55+
$scope.gridOptions.data = response.data;
5656
});
5757
}]);
5858
</file>

misc/tutorial/109_multiple_grids.ngdoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ Using multiple grids on a single page
1414
$scope.gridOptions2 = {};
1515

1616
$http.get('/data/100.json')
17-
.success(function(data) {
18-
$scope.gridOptions1.data = data;
17+
.then(function(response) {
18+
$scope.gridOptions1.data = response.data;
1919
});
2020

2121
$http.get('/data/500.json')
22-
.success(function(data) {
23-
$scope.gridOptions2.data = data;
22+
.then(function(response) {
23+
$scope.gridOptions2.data = response.data;
2424
});
2525
}]);
2626
</file>

misc/tutorial/110_grid_in_modal.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ In a sense this is similar to what the auto-resize feature does, but it only doe
3333
};
3434

3535
$http.get('/data/100.json')
36-
.success(function(data) {
37-
$rootScope.gridOptions.data = data;
36+
.then(function(response) {
37+
$rootScope.gridOptions.data = response.data;
3838
});
3939

4040
$scope.showModal = function() {

misc/tutorial/111_cellClass.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ In this example, we will override the color and background for the first column
2727
};
2828

2929
$http.get('/data/100.json')
30-
.success(function(data) {
31-
$scope.gridOptions.data = data;
30+
.then(function(response) {
31+
$scope.gridOptions.data = response.data;
3232
});
3333
}]);
3434
</file>

misc/tutorial/113_adding_and_removing_columns.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def properties), and call the notifyDataChange api to force an update.
5656
}
5757

5858
$http.get('/data/100.json')
59-
.success(function(data) {
60-
$scope.gridOptions.data = data;
59+
.then(function(response) {
60+
$scope.gridOptions.data = response.data;
6161
});
6262
}]);
6363
</file>

misc/tutorial/114_row_header.ngdoc

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ You can add a row header column, which goes into the left pinned container
2323
};
2424

2525
$http.get('/data/100.json')
26-
.success(function(data) {
27-
$scope.gridOptions.data = data;
28-
console.log(data)
26+
.then(function(response) {
27+
$scope.gridOptions.data = response.data;
2928
});
3029
}]);
3130
</file>

misc/tutorial/115_headerCellClass.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ set the background and foreground color of the header if the sort direction is A
3333
};
3434

3535
$http.get('/data/100.json')
36-
.success(function(data) {
37-
$scope.gridOptions.data = data;
36+
.then(function(response) {
37+
$scope.gridOptions.data = response.data;
3838
});
3939
}]);
4040
</file>

misc/tutorial/117_tooltips.ngdoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ Tooltips respect the cellFilter, so if you define a cellFilter it will also be u
5959
};
6060

6161
$http.get('/data/100.json')
62-
.success(function(data) {
63-
data.forEach( function setGender( row, index ){
64-
row.gender = row.gender==='male' ? '1' : '2';
62+
.then(function(response) {
63+
response.data.forEach( function setGender( row, index ){
64+
row.gender = row.gender === 'male' ? '1' : '2';
6565
});
6666

67-
$scope.gridOptions.data = data;
67+
$scope.gridOptions.data = response.data;
6868
});
6969
}])
7070
.filter('mapGender', function() {

misc/tutorial/120_RTL.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ The grid supports RTL languages
3131
};
3232

3333
$http.get('/data/100.json')
34-
.success(function(data) {
35-
$scope.gridOptions.data = data;
34+
.then(function(response) {
35+
$scope.gridOptions.data = response.data;
3636
});
3737
}]);
3838
</file>

misc/tutorial/121_grid_menu.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ In the meantime, you can override the height to fit with your application in you
8888
};
8989

9090
$http.get('/data/100.json')
91-
.success(function(data) {
92-
$scope.gridOptions.data = data;
91+
.then(function(response) {
92+
$scope.gridOptions.data = response.data;
9393
});
9494
}]);
9595
</file>

misc/tutorial/122_accessibility.ngdoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ You can visualize the accessibility roles that have been applied to the grid usi
147147
angular.extend($scope.paginationGridOptions, $scope.virtualGridOptions);
148148

149149
$http.get('/data/100.json')
150-
.success(function(data) {
151-
data.forEach(setGender);
152-
$scope.virtualGridOptions.data = data;
153-
$scope.paginationGridOptions.data = data;
150+
.then(function(response) {
151+
response.data.forEach(setGender);
152+
$scope.virtualGridOptions.data = response.data;
153+
$scope.paginationGridOptions.data = response.data;
154154
});
155155
}])
156156
.filter('mapGender', function() {

misc/tutorial/190_large_dataset.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Demonstrates the following:
3030

3131
var canceler = $q.defer();
3232
$http.get('/data/10000_complex.json', {timeout: canceler.promise})
33-
.success(function(data) {
34-
$scope.gridOptions.data = data;
33+
.then(function(response) {
34+
$scope.gridOptions.data = response.data;
3535
});
3636

3737
$scope.$on('$destroy', function(){

misc/tutorial/201_editable.ngdoc

+3-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ $scope.gridOptions.columnDefs = [
166166
};
167167

168168
$http.get('/data/500_complex.json')
169-
.success(function(data) {
169+
.then(function(response) {
170+
var data = response.data;
171+
170172
for(i = 0; i < data.length; i++){
171173
data[i].registered = new Date(data[i].registered);
172174
data[i].gender = data[i].gender==='male' ? 1 : 2;

misc/tutorial/202_cellnav.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ while still allowing the right arrow to be handled by the grid.
5454
];
5555

5656
$http.get('/data/500_complex.json')
57-
.success(function(data) {
58-
$scope.gridOptions.data = data;
57+
.then(function(response) {
58+
$scope.gridOptions.data = response.data;
5959
});
6060

6161
$scope.info = {};

misc/tutorial/203_pinning.ngdoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ It is also possible to disable pinning on column level. Note the 'id' column def
4040
];
4141

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

8989
$http.get('/data/500_complex.json')
90-
.success(function(data) {
91-
$scope.gridOptions.data = data;
90+
.then(function(response) {
91+
$scope.gridOptions.data = response.data;
9292
});
9393
}]);
9494
</file>

misc/tutorial/204_column_resizing.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ $scope.gridOptions = {
7070
};
7171

7272
$http.get('/data/100.json')
73-
.success(function(data) {
74-
$scope.gridOptions.data = data;
73+
.then(function(response) {
74+
$scope.gridOptions.data = response.data;
7575
});
7676
}]);
7777
</file>

misc/tutorial/205_row_editable.ngdoc

+3-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ each save will take 3 seconds to complete. Any row saved with a gender of "male
109109
};
110110

111111
$http.get('/data/500_complex.json')
112-
.success(function(data) {
112+
.then(function(response) {
113+
var data = response.data;
114+
113115
for(i = 0; i < data.length; i++){
114116
data[i].registered = new Date(data[i].registered);
115117
}

misc/tutorial/206_exporting_data.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ In this example we use the native grid menu buttons, and we show both the pdf an
9292
};
9393

9494
$http.get('/data/100.json')
95-
.success(function(data) {
96-
$scope.gridOptions.data = data;
95+
.then(function(response) {
96+
$scope.gridOptions.data = response.data;
9797
});
9898

9999
}]);

misc/tutorial/208_save_state.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ to something different, and use the restore button to set the grid back the way
8080
};
8181

8282
$http.get('/data/100.json')
83-
.success(function(data) {
84-
$scope.gridOptions.data = data;
83+
.then(function(response) {
84+
$scope.gridOptions.data = response.data;
8585
});
8686
}]);
8787
</file>

misc/tutorial/209_grouping.ngdoc

+3-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ function will stop working), and writes them to the console.
131131
};
132132

133133
$http.get('/data/500_complex.json')
134-
.success(function(data) {
134+
.then(function(response) {
135+
var data = response.data;
136+
135137
for ( var i = 0; i < data.length; i++ ){
136138
var registeredDate = new Date( data[i].registered );
137139
data[i].state = data[i].address.state;

misc/tutorial/210_selection.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ auto-selects the first row once the data is loaded.
7878
$scope.gridOptions.multiSelect = true;
7979

8080
$http.get('/data/500_complex.json')
81-
.success(function(data) {
82-
$scope.gridOptions.data = data;
81+
.then(function(response) {
82+
$scope.gridOptions.data = response.data;
8383
$timeout(function() {
8484
if($scope.gridApi.selection.selectRow){
8585
$scope.gridApi.selection.selectRow($scope.gridOptions.data[0]);

misc/tutorial/213_auto_resizing.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ To use, include the `'ui.grid.autoResize'` module in your angular app's dependen
3636
];
3737

3838
$http.get('/data/500_complex.json')
39-
.success(function(data) {
40-
$scope.gridOptions.data = data;
39+
.then(function(response) {
40+
$scope.gridOptions.data = response.data;
4141
});
4242

4343
$scope.randomSize = function () {

misc/tutorial/214_pagination.ngdoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ using {@link 212_infinite_scroll infinite scroll}, which also retrieves data in
4646
}
4747

4848
$http.get('/data/100.json')
49-
.success(function (data) {
50-
$scope.gridOptions1.data = data;
51-
$scope.gridOptions2.data = data;
49+
.then(function (response) {
50+
$scope.gridOptions1.data = response.data;
51+
$scope.gridOptions2.data = response.data;
5252
});
5353
}]);
5454
</file>

misc/tutorial/215_treeView.ngdoc

+3-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ are loaded only when that row is expanded. They have a 2 second delay to simula
9292
};
9393

9494
$http.get('/data/500_complex.json')
95-
.success(function(data) {
95+
.then(function(response) {
96+
var data = response.data;
97+
9698
for ( var i = 0; i < data.length; i++ ){
9799
data[i].state = data[i].address.state;
98100
data[i].balance = Number( data[i].balance.slice(1).replace(/,/,'') );

0 commit comments

Comments
 (0)