diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..c4b6b11 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "trailingComma": "es5", + "tabWidth": 2, + "useEditorConfig": false, + "singleQuote": true +} diff --git a/package-lock.json b/package-lock.json index 6626174..93e7bae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9654,6 +9654,11 @@ "uniq": "^1.0.1" } }, + "prettier": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", + "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==" + }, "pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", diff --git a/package.json b/package.json index b44e899..fe492ba 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@angular/platform-browser": "~13.0.3", "@angular/platform-browser-dynamic": "~13.0.3", "@angular/router": "~13.0.3", + "prettier": "^2.5.1", "rxjs": "~6.6.0", "tslib": "^2.3.0", "zone.js": "~0.11.4" diff --git a/src/ChangeStructure.md b/src/ChangeStructure.md index 57654b0..e490d62 100644 --- a/src/ChangeStructure.md +++ b/src/ChangeStructure.md @@ -1,3 +1,5 @@ # October 24 2021 Restructure App + ## Relocation of Services + ## Make Services more loosely coupled diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 86b254e..64e1dff 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,12 +1,12 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { BrowserModule } from '@angular/platform-browser'; -import {HttpClientModule} from '@angular/common/http'; +import { HttpClientModule } from '@angular/common/http'; const routes: Routes = []; @NgModule({ - imports: [RouterModule.forRoot(routes), BrowserModule, HttpClientModule], - exports: [RouterModule] + imports: [RouterModule.forRoot(routes), BrowserModule, HttpClientModule], + exports: [RouterModule], }) -export class AppRoutingModule { } +export class AppRoutingModule {} diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index dfb7e07..858c14f 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -1,7 +1,10 @@ import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { AppComponent } from './app.component'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { + HttpClientTestingModule, + HttpTestingController, +} from '@angular/common/http/testing'; // Other imports import { HttpClient, HttpErrorResponse } from '@angular/common/http'; @@ -13,17 +16,12 @@ describe('AppComponent', () => { let httpTestingController: HttpTestingController; beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ - RouterTestingModule, - HttpClientTestingModule - ], - declarations: [ - AppComponent - ], + imports: [RouterTestingModule, HttpClientTestingModule], + declarations: [AppComponent], }).compileComponents(); - // Inject the http service and test controller for each test - httpClient = TestBed.get(HttpClient); - httpTestingController = TestBed.get(HttpTestingController); + // Inject the http service and test controller for each test + httpClient = TestBed.get(HttpClient); + httpTestingController = TestBed.get(HttpTestingController); }); it('should create the app', () => { @@ -37,6 +35,4 @@ describe('AppComponent', () => { const app = fixture.componentInstance; expect(app.title).toEqual('WeatherApp'); }); - - }); diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9cdd41b..8806ac6 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -4,7 +4,7 @@ import { HttpService } from '../app/services/http/http.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.css'] + styleUrls: ['./app.component.css'], }) export class AppComponent { title = 'WeatherApp'; @@ -12,11 +12,5 @@ export class AppComponent { /** * */ - constructor(private httpService: HttpService) { - - - } - - - + constructor(private httpService: HttpService) {} } diff --git a/src/app/city-search/city-search.component.ts b/src/app/city-search/city-search.component.ts index 0bd1de7..b2d8849 100644 --- a/src/app/city-search/city-search.component.ts +++ b/src/app/city-search/city-search.component.ts @@ -1,56 +1,117 @@ -import {Component} from '@angular/core'; -import {from, Observable, of, OperatorFunction} from 'rxjs'; -import {debounceTime, distinctUntilChanged, map, tap} from 'rxjs/operators'; +import { Component } from '@angular/core'; +import { from, Observable, of, OperatorFunction } from 'rxjs'; +import { debounceTime, distinctUntilChanged, map, tap } from 'rxjs/operators'; import { HttpService } from '../services/http/http.service'; -import { WeatherInfo , CityLocation} from '../response-interfaces/response-interfaces'; +import { + WeatherInfo, + CityLocation, +} from '../response-interfaces/response-interfaces'; - -const states = ['Alabama', 'Alaska', 'American Samoa', 'Arizona', 'Arkansas', 'California', 'Colorado', - 'Connecticut', 'Delaware', 'District Of Columbia', 'Federated States Of Micronesia', 'Florida', 'Georgia', - 'Guam', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', - 'Marshall Islands', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', - 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', - 'Northern Mariana Islands', 'Ohio', 'Oklahoma', 'Oregon', 'Palau', 'Pennsylvania', 'Puerto Rico', 'Rhode Island', - 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virgin Islands', 'Virginia', - 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']; +const states = [ + 'Alabama', + 'Alaska', + 'American Samoa', + 'Arizona', + 'Arkansas', + 'California', + 'Colorado', + 'Connecticut', + 'Delaware', + 'District Of Columbia', + 'Federated States Of Micronesia', + 'Florida', + 'Georgia', + 'Guam', + 'Hawaii', + 'Idaho', + 'Illinois', + 'Indiana', + 'Iowa', + 'Kansas', + 'Kentucky', + 'Louisiana', + 'Maine', + 'Marshall Islands', + 'Maryland', + 'Massachusetts', + 'Michigan', + 'Minnesota', + 'Mississippi', + 'Missouri', + 'Montana', + 'Nebraska', + 'Nevada', + 'New Hampshire', + 'New Jersey', + 'New Mexico', + 'New York', + 'North Carolina', + 'North Dakota', + 'Northern Mariana Islands', + 'Ohio', + 'Oklahoma', + 'Oregon', + 'Palau', + 'Pennsylvania', + 'Puerto Rico', + 'Rhode Island', + 'South Carolina', + 'South Dakota', + 'Tennessee', + 'Texas', + 'Utah', + 'Vermont', + 'Virgin Islands', + 'Virginia', + 'Washington', + 'West Virginia', + 'Wisconsin', + 'Wyoming', +]; @Component({ selector: 'app-city-search', templateUrl: './city-search.component.html', - styles: [`.form-control { width: 300px; }`] + styles: [ + ` + .form-control { + width: 300px; + } + `, + ], }) export class CitySearchComponent { public model: any; public location!: CityLocation[]; - constructor(private httpService: HttpService) { - - } + constructor(private httpService: HttpService) {} - search: OperatorFunction = (text$: Observable) => + search: OperatorFunction = ( + text$: Observable + ) => text$.pipe( debounceTime(300), distinctUntilChanged(), - tap(r=> this.getCity()), - map(term => term.length < 2 ? [] - : this.handleArryOfLocationData(term) ) // TODO: investigate slice amount // - ) - - handleArryOfLocationData(term : string):string[]{ - let cities = [this.location[0].name]; - return cities.filter(v => v.toLowerCase().indexOf(term.toLowerCase()) > -1).slice(0, 10) - // return [""]; - } + tap((r) => this.getCity()), + map((term) => + term.length < 2 ? [] : this.handleArryOfLocationData(term) + ) // TODO: investigate slice amount // + ); - getCity() { - // TODO have to change httpservice to take url - // const weatherInfo$ = this.httpService.getWeather('c19fda244ae14731aa532946210710') ; // TODo hide westher key - // weatherInfo$.subscribe( w => { - // console.log(w.location); - // this.location = [w.location] ; - // }); - - - } + handleArryOfLocationData(term: string): string[] { + let cities = [this.location[0].name]; + return cities + .filter((v) => v.toLowerCase().indexOf(term.toLowerCase()) > -1) + .slice(0, 10); + // return [""]; + } + getCity() { + // TODO have to change httpservice to take url + // const weatherInfo$ = this.httpService.getWeather('c19fda244ae14731aa532946210710') ; // TODo hide westher key + // weatherInfo$.subscribe( w => { + // console.log(w.location); + // this.location = [w.location] ; + // }); + } } diff --git a/src/app/config/config.component.spec.ts b/src/app/config/config.component.spec.ts index 91317f3..e96bf98 100644 --- a/src/app/config/config.component.spec.ts +++ b/src/app/config/config.component.spec.ts @@ -8,9 +8,8 @@ describe('ConfigComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ ConfigComponent ] - }) - .compileComponents(); + declarations: [ConfigComponent], + }).compileComponents(); }); beforeEach(() => { diff --git a/src/app/config/config.component.ts b/src/app/config/config.component.ts index 7e1d487..7c29b64 100644 --- a/src/app/config/config.component.ts +++ b/src/app/config/config.component.ts @@ -5,10 +5,7 @@ import { Component, OnInit } from '@angular/core'; templateUrl: './config.component.html', }) export class ConfigComponent implements OnInit { + constructor() {} - constructor() { } - - ngOnInit(): void { - } - + ngOnInit(): void {} } diff --git a/src/app/config/config.service.ts b/src/app/config/config.service.ts index e96d15a..6cb5090 100644 --- a/src/app/config/config.service.ts +++ b/src/app/config/config.service.ts @@ -7,24 +7,22 @@ export interface Config { heroesUrl: string; textfile: string; date: any; - weatherKey:string; + weatherKey: string; } @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class ConfigService { - /** - * - */ - // inject the HttpClient service as a dependency of an application class, as shown in the following - constructor(private http:HttpClient) { + /** + * + */ + // inject the HttpClient service as a dependency of an application class, as shown in the following + constructor(private http: HttpClient) {} - } + configUrl = 'assets/config.json'; - configUrl = 'assets/config.json'; - - getConfig(){ - return this.http.get(this.configUrl); - } + getConfig() { + return this.http.get(this.configUrl); + } } diff --git a/src/app/display-current-weather/display-current-weather.component.spec.ts b/src/app/display-current-weather/display-current-weather.component.spec.ts index 8415d53..2419652 100644 --- a/src/app/display-current-weather/display-current-weather.component.spec.ts +++ b/src/app/display-current-weather/display-current-weather.component.spec.ts @@ -4,7 +4,10 @@ import { By } from '@angular/platform-browser'; import { DebugElement } from '@angular/core'; /* tslint:disable:no-unused-variable */ -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { + HttpClientTestingModule, + HttpTestingController, +} from '@angular/common/http/testing'; // Other imports import { HttpClient, HttpErrorResponse } from '@angular/common/http'; @@ -21,10 +24,9 @@ describe('DisplayForecastComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ DisplayCurrentWeatherComponent ], - imports: [ HttpClientTestingModule ] - }) - .compileComponents(); + declarations: [DisplayCurrentWeatherComponent], + imports: [HttpClientTestingModule], + }).compileComponents(); httpClient = TestBed.get(HttpClient); httpTestingController = TestBed.get(HttpTestingController); })); diff --git a/src/app/display-current-weather/display-current-weather.component.ts b/src/app/display-current-weather/display-current-weather.component.ts index 17a6b54..8aae6e3 100644 --- a/src/app/display-current-weather/display-current-weather.component.ts +++ b/src/app/display-current-weather/display-current-weather.component.ts @@ -3,59 +3,52 @@ import { Observable } from 'rxjs'; import { Config, ConfigService } from '../config/config.service'; import { HttpService } from '../services/http/http.service'; -import { WeatherInfo, Current, Condition, CityLocation } from '../response-interfaces/response-interfaces'; - - +import { + WeatherInfo, + Current, + Condition, + CityLocation, +} from '../response-interfaces/response-interfaces'; @Component({ selector: 'app-display-current-weather', templateUrl: './display-current-weather.component.html', - styleUrls: ['./display-current-weather.component.css'] + styleUrls: ['./display-current-weather.component.css'], }) - export class DisplayCurrentWeatherComponent implements OnInit { - currentWeather$!: Observable< WeatherInfo>; + currentWeather$!: Observable; public location!: CityLocation; - public current!: Current; + public current!: Current; public condition!: Condition; // private weatherResponses : WeatherInfo[] = []; // private weatherResponse! : WeatherInfo; - - config: Config | undefined ; + config: Config | undefined; weatherKey: string = ''; public city: string = 'Windsor'; public temperature: number = 0; + constructor( + private httpService: HttpService, + private configService: ConfigService + ) {} - - constructor(private httpService: HttpService, private configService: ConfigService) { - - } - - ngOnInit(){ - - this.configService.getConfig().subscribe( - (resp)=> { - this.weatherKey = resp.weatherKey; - } - ); - + ngOnInit() { + this.configService.getConfig().subscribe((resp) => { + this.weatherKey = resp.weatherKey; + }); } - onGetCurrentWeather(){ - let url = 'http://api.weatherapi.com/v1/current.json?key=c19fda244ae14731aa532946210710&q=Windsor&aqi=no' - let resp = this.httpService.getCurrentConditions(url); - resp.subscribe( - (res: WeatherInfo) => { - this.current = res.current; - this.condition = res.current.condition; - this.location = res.location; - console.log(res.current); - } - ) + onGetCurrentWeather() { + let url = + 'http://api.weatherapi.com/v1/current.json?key=c19fda244ae14731aa532946210710&q=Windsor&aqi=no'; + let resp = this.httpService.getCurrentConditions(url); + resp.subscribe((res: WeatherInfo) => { + this.current = res.current; + this.condition = res.current.condition; + this.location = res.location; + console.log(res.current); + }); } - - } diff --git a/src/app/response-interfaces/response-interfaces.ts b/src/app/response-interfaces/response-interfaces.ts index bbfac29..246696a 100644 --- a/src/app/response-interfaces/response-interfaces.ts +++ b/src/app/response-interfaces/response-interfaces.ts @@ -1,52 +1,52 @@ export interface WeatherInfo { location: CityLocation; - current:Current; + current: Current; } - export interface CityLocation { - name: string; - region: string; - country: string; - lat: number; - lon: number; - tz_id: string; - localtime_epoch: number; - localtime: string; - } +export interface CityLocation { + name: string; + region: string; + country: string; + lat: number; + lon: number; + tz_id: string; + localtime_epoch: number; + localtime: string; +} - export interface Condition { - text: string; - icon: string; - code: number; - } +export interface Condition { + text: string; + icon: string; + code: number; +} - export interface Current { - last_updated_epoch: number; - last_updated: string; - temp_c: number; - temp_f: number; - is_day: number; - condition: Condition; - wind_mph: number; - wind_kph: number; - wind_degree: number; - wind_dir: string; - pressure_mb: number; - pressure_in: number; - precip_mm: number; - precip_in: number; - humidity: number; - cloud: number; - feelslike_c: number; - feelslike_f: number; - vis_km: number; - vis_miles: number; - uv: number; - gust_mph: number; - gust_kph: number; - } +export interface Current { + last_updated_epoch: number; + last_updated: string; + temp_c: number; + temp_f: number; + is_day: number; + condition: Condition; + wind_mph: number; + wind_kph: number; + wind_degree: number; + wind_dir: string; + pressure_mb: number; + pressure_in: number; + precip_mm: number; + precip_in: number; + humidity: number; + cloud: number; + feelslike_c: number; + feelslike_f: number; + vis_km: number; + vis_miles: number; + uv: number; + gust_mph: number; + gust_kph: number; +} - export interface RootObject { - location: CityLocation; - current: Current; - } +export interface RootObject { + location: CityLocation; + current: Current; +} diff --git a/src/app/response-interfaces/temp.interface.ts b/src/app/response-interfaces/temp.interface.ts index 94074ba..871aa1b 100644 --- a/src/app/response-interfaces/temp.interface.ts +++ b/src/app/response-interfaces/temp.interface.ts @@ -1,144 +1,141 @@ declare module namespace { - export interface Location { - name: string; - region: string; - country: string; - lat: number; - lon: number; - tz_id: string; - localtime_epoch: number; - localtime: string; + name: string; + region: string; + country: string; + lat: number; + lon: number; + tz_id: string; + localtime_epoch: number; + localtime: string; } export interface Condition { - text: string; - icon: string; - code: number; + text: string; + icon: string; + code: number; } export interface Current { - last_updated_epoch: number; - last_updated: string; - temp_c: number; - temp_f: number; - is_day: number; - condition: Condition; - wind_mph: number; - wind_kph: number; - wind_degree: number; - wind_dir: string; - pressure_mb: number; - pressure_in: number; - precip_mm: number; - precip_in: number; - humidity: number; - cloud: number; - feelslike_c: number; - feelslike_f: number; - vis_km: number; - vis_miles: number; - uv: number; - gust_mph: number; - gust_kph: number; + last_updated_epoch: number; + last_updated: string; + temp_c: number; + temp_f: number; + is_day: number; + condition: Condition; + wind_mph: number; + wind_kph: number; + wind_degree: number; + wind_dir: string; + pressure_mb: number; + pressure_in: number; + precip_mm: number; + precip_in: number; + humidity: number; + cloud: number; + feelslike_c: number; + feelslike_f: number; + vis_km: number; + vis_miles: number; + uv: number; + gust_mph: number; + gust_kph: number; } export interface Condition2 { - text: string; - icon: string; - code: number; + text: string; + icon: string; + code: number; } export interface Day { - maxtemp_c: number; - maxtemp_f: number; - mintemp_c: number; - mintemp_f: number; - avgtemp_c: number; - avgtemp_f: number; - maxwind_mph: number; - maxwind_kph: number; - totalprecip_mm: number; - totalprecip_in: number; - avgvis_km: number; - avgvis_miles: number; - avghumidity: number; - daily_will_it_rain: number; - daily_chance_of_rain: number; - daily_will_it_snow: number; - daily_chance_of_snow: number; - condition: Condition2; - uv: number; + maxtemp_c: number; + maxtemp_f: number; + mintemp_c: number; + mintemp_f: number; + avgtemp_c: number; + avgtemp_f: number; + maxwind_mph: number; + maxwind_kph: number; + totalprecip_mm: number; + totalprecip_in: number; + avgvis_km: number; + avgvis_miles: number; + avghumidity: number; + daily_will_it_rain: number; + daily_chance_of_rain: number; + daily_will_it_snow: number; + daily_chance_of_snow: number; + condition: Condition2; + uv: number; } export interface Astro { - sunrise: string; - sunset: string; - moonrise: string; - moonset: string; - moon_phase: string; - moon_illumination: string; + sunrise: string; + sunset: string; + moonrise: string; + moonset: string; + moon_phase: string; + moon_illumination: string; } export interface Condition3 { - text: string; - icon: string; - code: number; + text: string; + icon: string; + code: number; } export interface Hour { - time_epoch: number; - time: string; - temp_c: number; - temp_f: number; - is_day: number; - condition: Condition3; - wind_mph: number; - wind_kph: number; - wind_degree: number; - wind_dir: string; - pressure_mb: number; - pressure_in: number; - precip_mm: number; - precip_in: number; - humidity: number; - cloud: number; - feelslike_c: number; - feelslike_f: number; - windchill_c: number; - windchill_f: number; - heatindex_c: number; - heatindex_f: number; - dewpoint_c: number; - dewpoint_f: number; - will_it_rain: number; - chance_of_rain: number; - will_it_snow: number; - chance_of_snow: number; - vis_km: number; - vis_miles: number; - gust_mph: number; - gust_kph: number; - uv: number; + time_epoch: number; + time: string; + temp_c: number; + temp_f: number; + is_day: number; + condition: Condition3; + wind_mph: number; + wind_kph: number; + wind_degree: number; + wind_dir: string; + pressure_mb: number; + pressure_in: number; + precip_mm: number; + precip_in: number; + humidity: number; + cloud: number; + feelslike_c: number; + feelslike_f: number; + windchill_c: number; + windchill_f: number; + heatindex_c: number; + heatindex_f: number; + dewpoint_c: number; + dewpoint_f: number; + will_it_rain: number; + chance_of_rain: number; + will_it_snow: number; + chance_of_snow: number; + vis_km: number; + vis_miles: number; + gust_mph: number; + gust_kph: number; + uv: number; } export interface Forecastday { - date: string; - date_epoch: number; - day: Day; - astro: Astro; - hour: Hour[]; + date: string; + date_epoch: number; + day: Day; + astro: Astro; + hour: Hour[]; } export interface Forecast { - forecastday: Forecastday[]; + forecastday: Forecastday[]; } export interface RootObject { - location: Location; - current: Current; - forecast: Forecast; + location: Location; + current: Current; + forecast: Forecast; } - } - diff --git a/src/app/services/http/http.service.spec.ts b/src/app/services/http/http.service.spec.ts index 2431387..b5606b9 100644 --- a/src/app/services/http/http.service.spec.ts +++ b/src/app/services/http/http.service.spec.ts @@ -1,5 +1,8 @@ /* tslint:disable:no-unused-variable */ -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { + HttpClientTestingModule, + HttpTestingController, +} from '@angular/common/http/testing'; // Other imports import { HttpClient, HttpErrorResponse } from '@angular/common/http'; @@ -13,16 +16,14 @@ describe('Service: Http', () => { beforeEach(() => { TestBed.configureTestingModule({ providers: [HttpService], - imports: [ HttpClientTestingModule ] + imports: [HttpClientTestingModule], }); - // Inject the http service and test controller for each test - httpClient = TestBed.get(HttpClient); - httpTestingController = TestBed.get(HttpTestingController); + // Inject the http service and test controller for each test + httpClient = TestBed.get(HttpClient); + httpTestingController = TestBed.get(HttpTestingController); }); - - it('should create', inject([HttpService], (service: HttpService) => { expect(service).toBeTruthy(); })); diff --git a/src/app/services/http/http.service.ts b/src/app/services/http/http.service.ts index c9d65dd..3a6509b 100644 --- a/src/app/services/http/http.service.ts +++ b/src/app/services/http/http.service.ts @@ -1,27 +1,26 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { CityLocation, WeatherInfo } from 'src/app/response-interfaces/response-interfaces'; +import { + CityLocation, + WeatherInfo, +} from 'src/app/response-interfaces/response-interfaces'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class HttpService { + constructor(private http: HttpClient) {} -constructor(private http: HttpClient) { } + public getWeather(url: string): Observable { + return this.http.get(url); + } -public getWeather(url: string ) : Observable { + public getCurrentConditions(url: string): Observable { + return this.http.get(url); + } - return this.http.get(url); + public getLocatiion(url: string, options: {}) { + return this.http.get(url); // TODO: fix naming collision + } } - -public getCurrentConditions(url: string): Observable{ - return this.http.get(url); -} - -public getLocatiion(url: string, options: {}){ - return this.http.get(url);// TODO: fix naming collision -} - -} - diff --git a/src/assets/config.json b/src/assets/config.json index 4454b4f..947b9ec 100644 --- a/src/assets/config.json +++ b/src/assets/config.json @@ -1,6 +1,6 @@ { - "heroesUrl": "api/heroes", - "textfile": "assets/textfile.txt", - "date": "2020-01-29", - "weatherKey" : "c19fda244ae14731aa532946210710" - } + "heroesUrl": "api/heroes", + "textfile": "assets/textfile.txt", + "date": "2020-01-29", + "weatherKey": "c19fda244ae14731aa532946210710" +} diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 3612073..c966979 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,3 +1,3 @@ export const environment = { - production: true + production: true, }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index f56ff47..66998ae 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -3,7 +3,7 @@ // The list of file replacements can be found in `angular.json`. export const environment = { - production: false + production: false, }; /* diff --git a/src/main.ts b/src/main.ts index c7b673c..d9a2e7e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,5 +8,6 @@ if (environment.production) { enableProdMode(); } -platformBrowserDynamic().bootstrapModule(AppModule) - .catch(err => console.error(err)); +platformBrowserDynamic() + .bootstrapModule(AppModule) + .catch((err) => console.error(err)); diff --git a/src/polyfills.ts b/src/polyfills.ts index 4eef33b..a1a22c5 100644 --- a/src/polyfills.ts +++ b/src/polyfills.ts @@ -49,8 +49,7 @@ import '@angular/localize/init'; /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ -import 'zone.js'; // Included with Angular CLI. - +import 'zone.js'; // Included with Angular CLI. /*************************************************************************************************** * APPLICATION IMPORTS diff --git a/src/styles.css b/src/styles.css index a97e1bb..7f690d8 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1,7 +1,7 @@ /* You can add global styles to this file, and also import other style files */ -@import "@angular/material/prebuilt-themes/indigo-pink.css"; +@import '@angular/material/prebuilt-themes/indigo-pink.css'; body { - font-family: Roboto, "Helvetica Neue", sans-serif; + font-family: Roboto, 'Helvetica Neue', sans-serif; } diff --git a/src/test.ts b/src/test.ts index b4dd603..6969a3e 100644 --- a/src/test.ts +++ b/src/test.ts @@ -4,11 +4,15 @@ import 'zone.js/testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, - platformBrowserDynamicTesting + platformBrowserDynamicTesting, } from '@angular/platform-browser-dynamic/testing'; declare const require: { - context(path: string, deep?: boolean, filter?: RegExp): { + context( + path: string, + deep?: boolean, + filter?: RegExp + ): { keys(): string[]; (id: string): T; }; @@ -18,7 +22,7 @@ declare const require: { getTestBed().initTestEnvironment( BrowserDynamicTestingModule, platformBrowserDynamicTesting(), - { teardown: { destroyAfterEach: true }}, + { teardown: { destroyAfterEach: true } } ); // Then we find all the tests.