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
class ImageSnippet { | |
constructor(public src: string, public file: File) {} | |
} | |
@Component({ | |
selector: 'bwm-image-upload', | |
templateUrl: 'image-upload.component.html', | |
styleUrls: ['image-upload.component.scss'] | |
}) |
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
class ImageSnippet { | |
constructor(public src: string, public file: File) {} | |
} | |
@Component({ | |
selector: 'bwm-image-upload', | |
templateUrl: 'image-upload.component.html', | |
styleUrls: ['image-upload.component.scss'] | |
}) | |
export class ImageUploadComponent { |
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
export class ImageService { | |
constructor(private http: Http) {} | |
public uploadImage(image: File): Observable<Response> { | |
const formData = new FormData(); | |
formData.append('image', image); |
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
class ImageSnippet { | |
pending: boolean = false; | |
status: string = 'init'; | |
constructor(public src: string, public file: File) {} | |
} | |
@Component({ | |
selector: 'bwm-image-upload', | |
templateUrl: 'image-upload.component.html', |
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
<label class="image-upload-container btn btn-bwm"> | |
<span>Select Image</span> | |
<input #imageInput | |
type="file" | |
accept="image/*" | |
(change)="processFile(imageInput)"> | |
</label> |
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
<label class="image-upload-container btn btn-bwm"> | |
<span>Select Image</span> | |
<input #imageInput | |
type="file" | |
accept="image/*" | |
(change)="processFile(imageInput)"> | |
</label> | |
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
input { | |
display: none; | |
} | |
.image-upload-container { | |
cursor: pointer; | |
} | |
.img-preview-container { |
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
import { NgModule } from '@angular/core'; | |
import { AgmCoreModule } from '@agm/core'; | |
import { CommonModule } from '@angular/common'; | |
import { MapComponent } from './map.component'; | |
import { MapService } from './map.service'; | |
@NgModule({ | |
declarations: [ | |
MapComponent |
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
private geocodeLocation(location: string): Observable<any> { | |
if (!this.geoCoder) this.geoCoder = new (<any>window).google.maps.Geocoder(); | |
return new Observable((observer) => { | |
this.geoCoder.geocode({address: location}, (result, status) => { | |
if (status === 'OK') { | |
const geometry = result[0].geometry.location; | |
const coordinates = {lat: geometry.lat(), lng: geometry.lng()}; | |
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
<agm-map | |
(mapReady)="mapReadyHandler()" | |
[latitude]="lat" | |
[longitude]="lng" | |
[zoom]="13"> | |
<agm-circle *ngIf="lat && lng" | |
[latitude]="lat" | |
[longitude]="lng" | |
[radius]="800" | |
[fillColor]="'#F44336'" |