Giter Site home page Giter Site logo

andrewjbateman / ionic-angular-weatherapi Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 2.0 9.08 MB

:clipboard: App to display weather data from a weather API using the Ionic 5 framework.

License: MIT License

JavaScript 6.98% TypeScript 60.46% HTML 11.16% SCSS 21.40%
scss-styles tutorial-code weatherstack-api angular weather-data weather-api ionic ionic6 forms angular15

ionic-angular-weatherapi's Introduction

Ionic Angular WeatherApi

  • App to display weather data from the Weatherstack weather API using the Ionic framework.
  • 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 GitHub pull requests GitHub Repo stars GitHub last commit

Table of contents

๐Ÿ“š General info

  • The Weatherstack weather API 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

๐Ÿ“ท Screenshots

Ionic page

๐Ÿ“ถ Technologies

๐Ÿ’พ Setup

  • npm i to install dependencies
  • Get yourself an API key from weatherstack.com and add to weather.service.ts line 4
  • To start the server on localhost://8100 type: 'ionic serve'

๐Ÿ’ป Code Examples

  • Extract from weather.service.ts that gets data from the API.
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.
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);
  });
}

๐Ÿ†’ Features

  • Searches for weather data in any city of the world
  • Ionic storage module used

๐Ÿ“‹ Status & To-do list

  • Status: Working.
  • To-do: Add to menu options - list of cities searched for etc. Convert to use Angular async pipe

๐Ÿ‘ Inspiration

๐Ÿ“ License

  • This project is licensed under the terms of the MIT license.

โœ‰๏ธ Contact

ionic-angular-weatherapi's People

Contributors

andrewjbateman avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.