数据库查询:
var query = new YQL('select * from weather.forecast where (location = '+req.params.locationNumber+')');
以下是HTML :
<select ng-model="city" class="form-control" ng-options="city.location as city.cityName for city in cities" ng-init="city=''" data-ng-click="getWeather(city)">
<option value="">Select City</option>
</select>
以下是Angular.js :
$scope.getWeather = function(data){
if(data){
appService.get({url: 'weather', id: data}).$promise.then(function(data) {
$scope.weather = data.temp;
}).catch(function(error){
growl.addErrorMessage('oops something went wrong');
});
}
}