https://github.com/krzysztofsaja/angular-weather-widget
Angualar 2+ weather widget component with Open Weather Map Api support
https://github.com/krzysztofsaja/angular-weather-widget
angular2 angular4 javascript-library weather weather-app widget
Last synced: 6 months ago
JSON representation
Angualar 2+ weather widget component with Open Weather Map Api support
- Host: GitHub
- URL: https://github.com/krzysztofsaja/angular-weather-widget
- Owner: krzysztofsaja
- License: mit
- Created: 2017-07-22T20:39:46.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-20T22:10:38.000Z (almost 8 years ago)
- Last Synced: 2025-04-30T05:06:32.593Z (6 months ago)
- Topics: angular2, angular4, javascript-library, weather, weather-app, widget
- Language: TypeScript
- Homepage:
- Size: 4.27 MB
- Stars: 15
- Watchers: 3
- Forks: 18
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Angular Weather Widget
[](https://travis-ci.org/krzysztofsaja/angular-weather-widget)
[](https://codecov.io/gh/krzysztofsaja/angular-weather-widget)
[](http://badge.fury.io/js/angular-weather-widget)
[](https://david-dm.org/krzysztofsaja/angular-weather-widget?type=dev)
[](https://github.com/krzysztofsaja/angular-weather-widget/issues)
[](https://github.com/krzysztofsaja/angular-weather-widget/stargazers)
[](https://raw.githubusercontent.com/krzysztofsaja/angular-weather-widget/master/LICENSE)## Demo
https://krzysztofsaja.github.io/angular-weather-widget/## Table of contents
- [About](#about)
- [Installation](#installation)
- [Documentation](#documentation)
- [Development](#development)
- [License](#license)## About
Weather Widget based on Open Weather Map Api
## Installation
Install through npm:
```
npm install --save angular-weather-widget
```Then include in your apps module:
```typescript
import { Component, NgModule } from '@angular/core';
import { AngularWeatherWidgetModule, WeatherApiName } from 'angular-weather-widget';@NgModule({
imports: [
AngularWeatherWidgetModule.forRoot({
key: OPEN_WEATHER_MAP_API_KEY,
name: WeatherApiName.OPEN_WEATHER_MAP,
baseUrl: 'http://api.openweathermap.org/data/2.5'
})
]
})
export class MyModule {}
```
## ConfigurationUse in one of your apps components:
```typescript
import { Component } from '@angular/core';
import { WeatherSettings, TemperatureScale, ForecastMode, WeatherLayout } from 'angular-weather-widget';@Component({
template: ''
})
export class MyComponent {
settings: WeatherSettings = {
location: {
cityName: 'Szczecin'
},
backgroundColor: '#347c57',
color: '#ffffff',
width: '300px',
height: 'auto',
showWind: false,
scale: TemperatureScale.CELCIUS,
forecastMode: ForecastMode.DETAILED,
showDetails: false,
showForecast: true,
layout: WeatherLayout.WIDE,
language: 'en'
};
}
```If you set proper OPEN_WEATHER_MAP_API_KEY key, data will be retrived from Open Weather Map Api. However, you can also pass relevant information from parent component, eg.
```typescript
import { Component } from '@angular/core';
import { WeatherSettings, TemperatureScale, ForecastMode } from 'angular-weather-widget';@Component({
template: ''
})
export class MyComponent {
currentWeather: CurrentWeather = CURRENT_WATHER_MOCK;
forecast: Forecast[] = FORECAST_MOCK;
settings: WeatherSettings = {
location: {
cityName: 'Szczecin'
}
};
}
```You may also find it useful to view the [demo source](https://github.com/krzysztofsaja/angular-weather/blob/master/demo/demo.component.ts).
You may also find it useful to view the [demo source](https://github.com/krzysztofsaja/angular-weather-widget/blob/master/demo/demo.component.ts).### Usage without a module bundler
```// everything is exported angularWeatherWidget namespace
```
## Documentation
All documentation is auto-generated from the source via [compodoc](https://compodoc.github.io/compodoc/) and can be viewed here:
https://krzysztofsaja.github.io/angular-weather-widget/docs/## Development
### Prepare your environment
* Install [Node.js](http://nodejs.org/) and [yarn](https://yarnpkg.com/en/docs/install)
* Install local dev dependencies: `yarn` while current directory is this repo### Development server
Run `yarn start` to start a development server on port 8000 with auto reload + tests.### Testing
Run `yarn test` to run tests once or `yarn run test:watch` to continually run tests.### Release
* Bump the version in package.json (once the module hits 1.0 this will become automatic)
```bash
yarn run release
```## License
MIT