diff --git a/src/demo-app/app/app.component.html b/src/demo-app/app/app.component.html
index 20b43dfb3f..a20e1d5276 100644
--- a/src/demo-app/app/app.component.html
+++ b/src/demo-app/app/app.component.html
@@ -139,4 +139,35 @@
+
+ Form module
+ map-field.component
+
+
+
+
+
diff --git a/src/demo-app/app/app.component.styl b/src/demo-app/app/app.component.styl
index 9022faa470..b94ed353e2 100644
--- a/src/demo-app/app/app.component.styl
+++ b/src/demo-app/app/app.component.styl
@@ -18,4 +18,9 @@ md-sidenav {
md-sidenav p {
width: 200px;
padding: 20px;
-}
\ No newline at end of file
+}
+
+.igo-map-field-container {
+ width: 300px;
+ height: 200px;
+}
diff --git a/src/demo-app/app/app.component.ts b/src/demo-app/app/app.component.ts
index acbf5ef5ba..991e086287 100644
--- a/src/demo-app/app/app.component.ts
+++ b/src/demo-app/app/app.component.ts
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
+import { FormGroup, FormBuilder, FormControl, Validators } from '@angular/forms';
import { ContextService, Feature, FeatureService, IgoMap,
LanguageService, MessageService, OverlayService,
@@ -13,13 +14,19 @@ export class AppComponent implements OnInit {
public map = new IgoMap();
public searchTerm: string;
+ public demoForm: FormGroup;
+
+ get locationField () {
+ return (this.demoForm.controls['location']);
+ }
constructor(public contextService: ContextService,
public featureService: FeatureService,
public messageService: MessageService,
public overlayService: OverlayService,
public toolService: ToolService,
- public language: LanguageService) {}
+ public language: LanguageService,
+ private formBuilder: FormBuilder) {}
ngOnInit() {
// If you do not want to load a context from a file,
@@ -28,6 +35,12 @@ export class AppComponent implements OnInit {
// as the contexts in ../contexts/
this.contextService.loadContext('_default');
+
+ this.demoForm = this.formBuilder.group({
+ location: ['', [
+ Validators.required
+ ]]
+ });
}
handleSearch(term: string) {
@@ -50,4 +63,9 @@ export class AppComponent implements OnInit {
this.featureService.unfocusFeature();
this.overlayService.clear();
}
+
+ handleFormSubmit(data: any, isValid: boolean) {
+ console.log(data);
+ console.log(isValid);
+ }
}
diff --git a/src/demo-app/assets/locale/en.json b/src/demo-app/assets/locale/en.json
index 6cdbe04d0f..7d9f930bca 100644
--- a/src/demo-app/assets/locale/en.json
+++ b/src/demo-app/assets/locale/en.json
@@ -1,3 +1,5 @@
{
- "Search for an address or a place": "Search for an address or a place"
+ "Location": "Location",
+ "Search for an address or a place": "Search for an address or a place",
+ "Submit": "Submit"
}
\ No newline at end of file
diff --git a/src/demo-app/assets/locale/fr.json b/src/demo-app/assets/locale/fr.json
index 729d76bb10..dc3cfa18a8 100644
--- a/src/demo-app/assets/locale/fr.json
+++ b/src/demo-app/assets/locale/fr.json
@@ -1,3 +1,5 @@
{
- "Search for an address or a place": "Rechercher une adresse, un lieu ou une couche"
+ "Location": "Localisation",
+ "Search for an address or a place": "Rechercher une adresse, un lieu ou une couche",
+ "Submit": "Soumettre"
}
\ No newline at end of file
diff --git a/src/lib/form/fields/index.ts b/src/lib/form/fields/index.ts
new file mode 100644
index 0000000000..944f40ecc5
--- /dev/null
+++ b/src/lib/form/fields/index.ts
@@ -0,0 +1 @@
+export * from './map-field';
diff --git a/src/lib/form/fields/map-field/index.ts b/src/lib/form/fields/map-field/index.ts
new file mode 100644
index 0000000000..63572da323
--- /dev/null
+++ b/src/lib/form/fields/map-field/index.ts
@@ -0,0 +1 @@
+export * from './map-field.component';
diff --git a/src/lib/form/fields/map-field/map-field.component.html b/src/lib/form/fields/map-field/map-field.component.html
new file mode 100644
index 0000000000..1258806899
--- /dev/null
+++ b/src/lib/form/fields/map-field/map-field.component.html
@@ -0,0 +1,11 @@
+