-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
31 lines (28 loc) · 952 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const weatherApp = angular.module("weatherApp",[]);
http:
weatherApp.run(function($rootScope,$http){
$http.get("http://api.openweathermap.org/data/2.5/box/city?bbox=70,20,75,25,8&appid={Add Your Open Weather Map Api Key Here...}")
.then(
function(responce){
$rootScope.weathers = responce.data.list;
},
function(responce){
$rootScope.message = $responce.status + " " + $responce.ststusText;
}
);
});
weatherApp.controller("weatherAppController", function($scope){
$scope.filterText="";
});
weatherApp.filter("searchFilter",function(){
console.log();
return function(weathers,filterText){
if(!filterText){
return weathers;
}
return weathers.filter(function(weather){
var keyword = new RegExp(filterText,'i');
return keyword.test(weather.name);
});
};
});