1.0.1 • Published 4 years ago

angular2-weather-widget v1.0.1

Weekly downloads
24
License
ISC
Repository
github
Last release
4 years ago

Angular 2/4/6/8 Weather Widget

npm version

Angular 2+ Weather Widget component for web applications. Easy and Highly customisable. Stackblitz example (need API key)

alt text

Getting Started

Installation

  • The Weather Widget package is published on the npm Registry.
  • Install the package : npm install angular2-weather-widget --save

  • Once installed import AngularWeatherWidgetModule from the installed package into your module as follows:

Usage

Import AngularWeatherWidgetModule into NgModule in app.module.ts. Angular's HttpClientModule and CommonModule is also required.

import { AngularWeatherWidgetModule } from 'angular2-weather-widget';
import { HttpClientModule } from '@angular/common/http';
import { CommonModule } from '@angular/common';

@NgModule({
  // ...
  imports: [
    AngularWeatherWidgetModule,
    HttpClientModule,
    CommonModule
  ]
  // ...
})
  • We are using "openweathermap" api to get weather details so SIGNUP and genereate api key for your project.

Add the following component tag in you template (no properties)

<angular-weather-widget
  [APIKEY]="'APIKEY'">
</angular-weather-widget>

Full properties

<angular-weather-widget
  [APIKEY]="'APIKEY'"
  [width]="'380px'"
  [height]="'auto'"
  [backgroundColor]="'green'" 
  [isBoxShadow]="true"
  [borderRadius]="'5px'"
  [locationFontSize]="'35px'"
  [locationFontColor]="'#fff'"
  [status]="true"
  [statusFontColor]="'#fff'"
  [statusFontSize]="'18px'"
  [temperature]="true"
  [tempratureFontColor]="'#fff'"
  [tempratureFontSize]="'75px'"
  [weatherImages]="true"
  [weatherImageWidth]="'110px'"
  [weatherImageHeight]="'110px'"
  [geoLocation]="true"
  [location]="''"
  [isWind]="true"
  [windFontColor]="'#fff'" 
  [windFontSize]="'17px'"
  [humidityFontColor]="'#fff'" 
  [humidityFontSize]="'17px'">
</angular-weather-widget>

Properties

The following list of properties are supported by the component.

PropertyTypeDescriptionDefault Value
APIKEYStringAPI key from APIUXAPIKEY
widthStringWidth of the weather card280px
heightStringHeight of the weather cardauto
backgroundColorStringBackground color of the weather card#2a2828
isBoxShadowBooleanBox shadow of the weather cardtrue
borderRadiusStringBorder-radius of the weather card5px
locationFontSizeStringFont size of the location text40px
locationFontColorStringColor of the location text#fff
statusBooleanCurrent weather statustrue
statusFontSizeStringFont size of the location text18px
statusFontColorStringColor of the status text#fff
temperatureBooleanTemperature of the locationtrue
tempratureFontSizeStringFont size of the temperature text80px
tempratureFontColorStringColor of the temperature text#fff
weatherImagesBooleanWeather icontrue
weatherImageWidthStringWeather icon width100px
weatherImageHeightStringWeather icon height100px
geoLocationBooleanAccess/Show weather of the user's locationtrue
locationStringShow one specific location's weather''
isWindBooleanWind of the locationtrue
windFontSizeStringFont size of the wind text20px
windFontColorStringColor of the wind text#fff
humidityFontColorStringFont size of the humidity text20px
humidityFontSizeStringColor of the humidity text#fff

Run locally

  • Clone the repository or downlod the .zip,.tar files.
  • Run npm install
  • Run ng serve for a dev server
  • Navigate to http://localhost:4200/

License

MIT License.