-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feature/allow-user-select-multiple-addresses): Create new google map…
…s view with current user location
- Loading branch information
Showing
5 changed files
with
55 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,7 @@ ion-item-group#address-info { | |
ion-button#save { | ||
margin-bottom: 10px; | ||
} | ||
|
||
.map { | ||
height: 60%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,31 +8,17 @@ | |
</ion-header> | ||
|
||
<ion-content> | ||
<div #container id="map-container" class="map"></div> | ||
<ion-card> | ||
<ion-card-header> | ||
<ion-card-title>Add new address</ion-card-title> | ||
<!-- <ion-card-title>Add new address</ion-card-title> --> | ||
</ion-card-header> | ||
<ion-card-content> | ||
<ion-item-group id="address-info"> | ||
<ion-row> | ||
<ion-col size="12"> | ||
<ion-item> | ||
<ion-input placeholder="City"></ion-input> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
zessu
Author
|
||
</ion-item> | ||
</ion-col> | ||
<ion-col size="12"> | ||
<ion-item> | ||
<ion-input placeholder="Street"></ion-input> | ||
</ion-item> | ||
</ion-col> | ||
<ion-col size="6"> | ||
<ion-item> | ||
<ion-input placeholder="House"></ion-input> | ||
</ion-item> | ||
</ion-col> | ||
<ion-col size="6"> | ||
<ion-item> | ||
<ion-input placeholder="Apartment"></ion-input> | ||
<ion-input placeholder="Enter a new address"></ion-input> | ||
</ion-item> | ||
</ion-col> | ||
</ion-row> | ||
|
41 changes: 33 additions & 8 deletions
41
shop/mobile-ionic/src/app/pages/user-locations/user-locations.page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,40 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Component, OnInit, ViewChild, ElementRef, AfterViewInit } from '@angular/core'; | ||
import { Geolocation } from '@ionic-native/geolocation/ngx'; | ||
import { Geoposition } from '@ionic-native/geolocation'; | ||
declare var google: any; | ||
|
||
@Component({ | ||
selector: 'e-cu-user-locations', | ||
templateUrl: './user-locations.page.html', | ||
styleUrls: ['./user-locations.page.css'], | ||
selector: 'e-cu-user-locations', | ||
templateUrl: './user-locations.page.html', | ||
styleUrls: ['./user-locations.page.css'], | ||
}) | ||
export class UserLocationsPage implements OnInit { | ||
export class UserLocationsPage implements OnInit, AfterViewInit { | ||
@ViewChild('container', { static: true }) container: ElementRef; | ||
public latitude: number; | ||
public longitude: number; | ||
public map: google.maps.Map; | ||
|
||
constructor() { } | ||
constructor(private geolocation: Geolocation) { } | ||
|
||
ngOnInit() { | ||
} | ||
ngOnInit() { | ||
this.geolocation.getCurrentPosition().then((_res: Geoposition) => { | ||
this.latitude = _res.coords.latitude; | ||
this.longitude = _res.coords.longitude; | ||
this.loadMap(); | ||
}); | ||
} | ||
|
||
|
||
loadMap() { | ||
this.map = new google.maps.Map(this.container.nativeElement, this.configureMapSettings()); | ||
} | ||
|
||
configureMapSettings() { | ||
return { | ||
zoom: 17, | ||
center: { lat: this.latitude, lng: this.longitude }, | ||
mapTypeControl: false, | ||
streetViewControl: false | ||
}; | ||
} | ||
} |
@zessu any reason why you removed that? I.e. per our talk user should be able to enter an address in the "Search" input, but also should be able to edit manually City, Street, House, etc... Or you are planning to use another control for manual edit?