JSPM

angular-openweathermap-api-factory

0.5.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q16222F
  • License MIT

angularjs factory for openweathermap json rest api requests

Package Exports

  • angular-openweathermap-api-factory

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (angular-openweathermap-api-factory) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

angular-openweathermap-api-factory is an angularjs module with a OpenWeatherMap API promise factory.

Author: Jonathan Hornung (JohnnyTheTank)

Usage

  1. Install via either bower, npm or downloaded files:
    1. bower install --save angular-openweathermap-api-factory
    2. npm install --save angular-openweathermap-api-factory
    3. download angular-openweathermap-api-factory.zip
  2. Add jtt_openweathermap to your application's module dependencies.
  3. Include dependencies in your HTML.
    1. When using bower:
    <script src="bower_components/angular-openweathermap-api-factory/src/angular-openweathermap-api-factory.min.js"></script>
    1. When using npm:
    <script src="node_modules/angular-openweathermap-api-factory/src/angular-openweathermap-api-factory.min.js"></script>
    1. when using downloaded files
    <script src="angular-openweathermap-api-factory.min.js"></script>
  4. Use the factory openweathermapFactory

factory methods

weather from city by name

// docs: http://openweathermap.org/current#name
openweathermapFactory.getWeatherFromCitySearchByName({
    q:"<CITY_NAME>,<COUNTRY_CODE>", //city name and country code divided by comma, use ISO 3166 country codes eg "London,uk"
    lang:"<LANGUAGE>", // (optional) http://openweathermap.org/current#multi
    units:"<UNITS>", // (optinal) http://openweathermap.org/current#data
    type:"<TYPE>", // (optional) 'like' = close result, 'accurate' = accurate result
    appid:"<APP_ID>"
}).then(function(_data){
    //on success
}).catch(function (_data) {
    //on error
});

weather from city by id

// docs: http://openweathermap.org/current#cityid
openweathermapFactory.getWeatherFromCityById({
    id:"<CITY_ID>", //List of city ID can be downloaded here http://bulk.openweathermap.org/sample/city.list.json.gz
    lang:"<LANGUAGE>", // (optional) http://openweathermap.org/current#multi
    units:"<UNITS>", // (optinal) http://openweathermap.org/current#data
    appid:"<APP_ID>"
}).then(function(_data){
    //on success
}).catch(function (_data) {
    //on error
});

weather from group of cities by id

// docs: http://openweathermap.org/current#severalid
openweathermapFactory.getWeatherFromGroupOfCitiesById({
    id:"<CITY_ID>,<CITY_ID>,<CITY_ID>,...", //List of city ID can be downloaded here http://bulk.openweathermap.org/sample/city.list.json.gz
    lang:"<LANGUAGE>", // (optional) http://openweathermap.org/current#multi
    units:"<UNITS>", // (optinal) http://openweathermap.org/current#data
    appid:"<APP_ID>"
}).then(function(_data){
    //on success
}).catch(function (_data) {
    //on error
});

weather from location by coordinates

// docs: http://openweathermap.org/current#geo
openweathermapFactory.getWeatherFromLocationByCoordinates({
    lat:"<LAT>",
    lon:"<LONG>",
    lang:"<LANGUAGE>", // (optional) http://openweathermap.org/current#multi
    units:"<UNITS>", // (optinal) http://openweathermap.org/current#data
    appid:"<APP_ID>"
}).then(function(_data){
    //on success
}).catch(function (_data) {
    //on error
});

weather from location by zipcode

// docs: http://openweathermap.org/current#zip
openweathermapFactory.getWeatherFromLocationByCoordinates({
    zip:"<ZIPCODE>,<COUNTRY_CODE>", //use ISO 3166 country codes
    lang:"<LANGUAGE>", // http://openweathermap.org/current#multi
    units:"<UNITS>", // (optinal) http://openweathermap.org/current#data
    appid:"<APP_ID>"
}).then(function(_data){
    //on success
}).catch(function (_data) {
    //on error
});

OpenWeatherMap JSON API

License

MIT