Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrewjbateman/ionic-angular-weatherapi
:clipboard: App to display weather data from a weather API using the Ionic 5 framework.
https://github.com/andrewjbateman/ionic-angular-weatherapi
angular angular15 forms ionic ionic6 scss-styles tutorial-code weather-api weather-data weatherstack-api
Last synced: about 2 months ago
JSON representation
:clipboard: App to display weather data from a weather API using the Ionic 5 framework.
- Host: GitHub
- URL: https://github.com/andrewjbateman/ionic-angular-weatherapi
- Owner: AndrewJBateman
- License: mit
- Created: 2019-07-03T18:12:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-03T04:55:40.000Z (almost 2 years ago)
- Last Synced: 2023-03-02T09:37:21.406Z (almost 2 years ago)
- Topics: angular, angular15, forms, ionic, ionic6, scss-styles, tutorial-code, weather-api, weather-data, weatherstack-api
- Language: TypeScript
- Homepage:
- Size: 8.87 MB
- Stars: 2
- Watchers: 0
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ionic Angular WeatherApi
* App to display weather data from the [Weatherstack weather API](https://weatherstack.com/documentation) using the [Ionic framework](https://ionicframework.com/docs).
* Some changes were made to the code so it would work in the latest Angular version.
* **Note:** to open web links in a new window use: _ctrl+click on link_![GitHub repo size](https://img.shields.io/github/repo-size/AndrewJBateman/ionic-angular-weatherapi?style=plastic)
![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/ionic-angular-weatherapi?style=plastic)
![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/ionic-angular-weatherapi?style=plastic)
![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/ionic-angular-weatherapi?style=plastic)## Table of contents
* [Ionic Angular WeatherApi](#ionic-angular-weatherapi)
* [Table of contents](#table-of-contents)
* [:books: General info](#books-general-info)
* [:camera: Screenshots](#camera-screenshots)
* [:signal_strength: Technologies](#signal_strength-technologies)
* [:floppy_disk: Setup](#floppy_disk-setup)
* [:computer: Code Examples](#computer-code-examples)
* [:cool: Features](#cool-features)
* [:clipboard: Status & To-do list](#clipboard-status--to-do-list)
* [:clap: Inspiration](#clap-inspiration)
* [:file_folder: License](#file_folder-license)
* [:envelope: Contact](#envelope-contact)## :books: General info
* The [Weatherstack weather API](https://weatherstack.com/documentation) is a fully managed weather API platform that provides extensive APIs
that supply the following data:* Real-time weather
* Up to 14 day weather forecast
* Historical weather inforamtion
* Astronomy
* Time zone
* Geolocation data## :camera: Screenshots
![Ionic page](./img/weather.png)
## :signal_strength: Technologies
* [Ionic v6](https://ionicframework.com/)
* [Angular v15](https://angular.io/)
* [Ionic/angular v6](https://www.npmjs.com/package/@ionic/angular)
* [Ionic storage-angular v3](https://www.npmjs.com/package/@ionic/storage-angular)
* [Weatherstack weather API](https://weatherstack.com/documentation)## :floppy_disk: Setup
* `npm i` to install dependencies
* Get yourself an API key from [weatherstack.com](https://weatherstack.com/) and add to `weather.service.ts` line 4
* To start the server on _localhost://8100_ type: 'ionic serve'## :computer: Code Examples
* Extract from `weather.service.ts` that gets data from the API.
```typescript
export class WeatherService {constructor(private httpClient: HttpClient) {}
getWeatherFromApi(city: string) {
return this.httpClient.get(`http://api.weatherstack.com/current?access_key=${apiKey}&query=${city}`);
}
}
```* Extract from `list.page.ts` function to get API weather data.
```typescript
getWeather() {
this.ionicStorage.get('city').then( city => {
if (city === null) {
this.weatherService.getWeatherFromApi('madrid').subscribe( weather => {
this.weather = weather;
console.log(weather);
});
} else {
this.weatherService.getWeatherFromApi(city).subscribe( weather => {
this.weather = weather;
console.log(weather);
});
}}).catch(err => {
console.log(err);
});
}
```## :cool: Features
* Searches for weather data in any city of the world
* Ionic storage module used## :clipboard: Status & To-do list
* Status: Working.
* To-do: Add to menu options - list of cities searched for etc. Convert to use Angular async pipe## :clap: Inspiration
* [Aldo Caamal: Simple Weather App ( Ionic 4 / Angular 7 / Apixu API )](https://www.youtube.com/watch?v=P6RDIjF66dw&t=137s).
## :file_folder: License
* This project is licensed under the terms of the MIT license.
## :envelope: Contact
* Repo created by [ABateman](https://github.com/AndrewJBateman), email: [email protected]