restomax-weather
v1.6.0
Published
This library use wunderground api to get weather. U must to have an API Key to access on this API.
Downloads
3
Readme
REQUIRENT
This library use wunderground api to get weather. U must to have an API Key to access on this API.
Sign Up to www.wunderground.com and get the API Key to https://www.wunderground.com/api in "Key Settings" Tab.
INSTALL
Run npm i --save restomax-weather
USE RESTOMAX-WEATHER
Import Module to your project
import { RMXWeatherModule } from 'restomax-weather';
@NgModule({
imports: [
...
RMXWeatherModule,
...
],
...
})
export class AppModule {}
Use Module
import { OnInit } from '@angular/core';
import { RMXWeatherProvider } from 'restomax-weather';
@Component({
selector: 'app-component',
templateUrl: 'app-component.html',
styleUrls: ['app-component.scss']
})
export class AppComponent implements OnInit {
constructor(
...
private pWeather: RMXWeatherProvider,
...
)
ngOnInit() {
this.pWeather.intialize({'yourWeatherApiKey', State: 'Your State', City: 'Your City'});
this.pWeather.weatherSubject.subscribe(
weather => {
// ... weather;
},
error => console.warn(error)
);
this.pWeather.predictSubject.subscribe(
predict => {
// ... predict;
},
error => console.warn(JSON.stringify(error))
);
}
}