diff --git a/src/app/app.component.css b/src/app/app.component.css index 5378f67..d28069b 100644 --- a/src/app/app.component.css +++ b/src/app/app.component.css @@ -14,62 +14,6 @@ header p{ float:right; } -.searchField{ - display:block; - float:left; - margin-top: 10px; -} - -.searchField input{ - margin-left: 25px; - border: 1px solid white; - border-radius: 3px; - background-color: rgb(253, 253, 253); - height: 20px; - font-size: 13pt; - font-weight: bold; - font-family: 'Roboto'; - padding: 5px; -} - -.autocomplete { - position: relative; - display: inline-block; - color: black; - } - -.autocomplete-items { - position: absolute; - border: 1px solid #d4d4d4; - border-bottom: none; - border-top: none; - z-index: 99; - /*position the autocomplete items to be the same width as the container:*/ - top: 100%; - left: 0; - right: 0; -} - - .autocomplete-items div { - padding: 10px; - cursor: pointer; - background-color: #fff; - border-bottom: 1px solid #d4d4d4; -} - - /*when hovering an item:*/ - .autocomplete-items div:hover { - background-color: #e9e9e9; -} - - /*when navigating through the items using the arrow keys:*/ - .autocomplete-active { - background-color: DodgerBlue !important; - color: #ffffff; -} - - - #map{ width: 100%; height: 100%; diff --git a/src/app/app.component.html b/src/app/app.component.html index e4963ba..b78cf35 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,13 +1,5 @@
-
-
- -
-
test
-
-
- -
+

{{title}}

diff --git a/src/app/app.component.ts b/src/app/app.component.ts index a779e2b..b80b6ca 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,6 +1,4 @@ -import { Component, OnInit, AfterViewInit, ElementRef, ViewChild} from '@angular/core'; -import { Nominatim } from './interfaces/nominatim'; -import { NominatimService } from './nominatim.service'; +import { Component, OnInit, AfterViewInit} from '@angular/core'; import { defaults as defaultControls } from 'ol/control'; import { fromLonLat } from 'ol/proj'; @@ -20,24 +18,6 @@ export class AppComponent implements AfterViewInit, OnInit { title = "Street Map"; map: Map; - @ViewChild("inputautocompleteList") autocompleteList: ElementRef; - - - constructor(private nominatimService: NominatimService) { } - - updateAutoCompleteList(): void{ - this.autocompleteList.nativeElement.innerHTML = "Fsd"; - } - - // Gets called in "app.component.html" when an input changes its value - getValue(valueFrom:string, valueTo:string): void{ - console.log("From " + valueFrom + " to " + valueTo); - - this.nominatimService.sendQueryRequest(valueFrom) - .subscribe((response: Nominatim[]) => console.log(response)); - - } - ngOnInit() { } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 1be550e..6ce9c83 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,10 +2,12 @@ import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import {HttpClientModule} from '@angular/common/http'; import { AppComponent } from './app.component'; +import { SearchComponent } from './search/search.component'; @NgModule({ declarations: [ AppComponent, + SearchComponent, ], imports: [ BrowserModule, diff --git a/src/app/search/search.component.css b/src/app/search/search.component.css new file mode 100644 index 0000000..a2023e0 --- /dev/null +++ b/src/app/search/search.component.css @@ -0,0 +1,54 @@ + +.searchField{ + display:block; + float:left; + margin-top: 10px; +} + +.searchField input{ + margin-left: 25px; + border: 1px solid white; + border-radius: 3px; + background-color: rgb(253, 253, 253); + height: 20px; + font-size: 13pt; + font-weight: bold; + font-family: 'Roboto'; + padding: 5px; +} + +.autocomplete { + position: relative; + display: inline-block; + color: black; + } + +.autocomplete-items { + position: absolute; + border: 1px solid #d4d4d4; + border-bottom: none; + border-top: none; + z-index: 99; + /*position the autocomplete items to be the same width as the container:*/ + top: 100%; + left: 0; + right: 0; +} + + .autocomplete-items div { + padding: 10px; + cursor: pointer; + background-color: #fff; + border-bottom: 1px solid #d4d4d4; +} + + /*when hovering an item:*/ + .autocomplete-items div:hover { + background-color: #e9e9e9; +} + + /*when navigating through the items using the arrow keys:*/ + .autocomplete-active { + background-color: DodgerBlue !important; + color: #ffffff; +} \ No newline at end of file diff --git a/src/app/search/search.component.html b/src/app/search/search.component.html new file mode 100644 index 0000000..63a4035 --- /dev/null +++ b/src/app/search/search.component.html @@ -0,0 +1,9 @@ +
+
+ +
+
test
+
+
+ +
\ No newline at end of file diff --git a/src/app/search/search.component.spec.ts b/src/app/search/search.component.spec.ts new file mode 100644 index 0000000..918ce70 --- /dev/null +++ b/src/app/search/search.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SearchComponent } from './search.component'; + +describe('SearchComponent', () => { + let component: SearchComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ SearchComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(SearchComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/search/search.component.ts b/src/app/search/search.component.ts new file mode 100644 index 0000000..b975629 --- /dev/null +++ b/src/app/search/search.component.ts @@ -0,0 +1,32 @@ +import { Component, OnInit, ElementRef, ViewChild} from '@angular/core'; +import { Nominatim } from '../interfaces/nominatim'; +import { NominatimService } from '../nominatim.service'; + +@Component({ + selector: 'app-search', + templateUrl: './search.component.html', + styleUrls: ['./search.component.css'] +}) + +export class SearchComponent implements OnInit { + @ViewChild("inputautocompleteList") autocompleteList: ElementRef; + + + constructor(private nominatimService: NominatimService) { } + + updateAutoCompleteList(): void{ + this.autocompleteList.nativeElement.innerHTML = "Fsd"; + } + + // Gets called in "app.component.html" when an input changes its value + getValue(valueFrom:string, valueTo:string): void{ + console.log("From " + valueFrom + " to " + valueTo); + + this.nominatimService.sendQueryRequest(valueFrom) + .subscribe((response: Nominatim[]) => console.log(response)); + + } + ngOnInit(): void { + } + +}