Skip to content

Commit 91b1c66

Browse files
committed
chore: replace .success() and .error() with .then() and .catch() (#1)
1 parent f46b20c commit 91b1c66

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ openweathermapFactory.getWeatherFromCitySearchByName({
2929
units:"<UNITS>", // (optinal) http://openweathermap.org/current#data
3030
type:"<TYPE>", // (optional) 'like' = close result, 'accurate' = accurate result
3131
appid:"<APP_ID>"
32-
}).success(function(_data){
32+
}).then(function(_data){
3333
//on success
34-
}).error(function (_data) {
34+
}).catch(function (_data) {
3535
//on error
3636
});
3737
```
@@ -44,9 +44,9 @@ openweathermapFactory.getWeatherFromCityById({
4444
lang:"<LANGUAGE>", // (optional) http://openweathermap.org/current#multi
4545
units:"<UNITS>", // (optinal) http://openweathermap.org/current#data
4646
appid:"<APP_ID>"
47-
}).success(function(_data){
47+
}).then(function(_data){
4848
//on success
49-
}).error(function (_data) {
49+
}).catch(function (_data) {
5050
//on error
5151
});
5252
```
@@ -59,9 +59,9 @@ openweathermapFactory.getWeatherFromGroupOfCitiesById({
5959
lang:"<LANGUAGE>", // (optional) http://openweathermap.org/current#multi
6060
units:"<UNITS>", // (optinal) http://openweathermap.org/current#data
6161
appid:"<APP_ID>"
62-
}).success(function(_data){
62+
}).then(function(_data){
6363
//on success
64-
}).error(function (_data) {
64+
}).catch(function (_data) {
6565
//on error
6666
});
6767
```
@@ -75,9 +75,9 @@ openweathermapFactory.getWeatherFromLocationByCoordinates({
7575
lang:"<LANGUAGE>", // (optional) http://openweathermap.org/current#multi
7676
units:"<UNITS>", // (optinal) http://openweathermap.org/current#data
7777
appid:"<APP_ID>"
78-
}).success(function(_data){
78+
}).then(function(_data){
7979
//on success
80-
}).error(function (_data) {
80+
}).catch(function (_data) {
8181
//on error
8282
});
8383
```
@@ -90,9 +90,9 @@ openweathermapFactory.getWeatherFromLocationByCoordinates({
9090
lang:"<LANGUAGE>", // http://openweathermap.org/current#multi
9191
units:"<UNITS>", // (optinal) http://openweathermap.org/current#data
9292
appid:"<APP_ID>"
93-
}).success(function(_data){
93+
}).then(function(_data){
9494
//on success
95-
}).error(function (_data) {
95+
}).catch(function (_data) {
9696
//on error
9797
});
9898
```

demo/js/app.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ app.controller('controller', ['$scope', 'openweathermapFactory', function($scope
66
openweathermapFactory.getWeatherFromCitySearchByName({
77
q:"munich",
88
appid:_appid
9-
}).success(function(_data){
9+
}).then(function(_data){
1010
console.info("weather from city by name", _data);
1111
});
1212

1313
openweathermapFactory.getWeatherFromCityById({
1414
id:"3220838",
1515
appid:_appid
16-
}).success(function(_data){
16+
}).then(function(_data){
1717
console.info("weather from city by id", _data);
1818
});
1919

2020
openweathermapFactory.getWeatherFromGroupOfCitiesById({
2121
id:"3220838,524901",
2222
appid:_appid
23-
}).success(function(_data){
23+
}).then(function(_data){
2424
console.info("weather from group of cities by id", _data);
2525
});
2626

2727
openweathermapFactory.getWeatherFromLocationByCoordinates({
2828
lat:"48.1",
2929
lon:"11.63",
3030
appid:_appid
31-
}).success(function(_data){
31+
}).then(function(_data){
3232
console.info("weather from location by coordinates", _data);
3333
});
3434

3535
openweathermapFactory.getWeatherFromLocationByZipcode({
3636
zip:"81539,de",
3737
appid:_appid
38-
}).success(function(_data){
38+
}).then(function(_data){
3939
console.info("weather from location by zipcode", _data);
4040
});
4141

0 commit comments

Comments
 (0)