modal dukker opp ved trykk paa kart
authorRoza Moustafa <roza.92m@hotmail.com>
Thu, 3 Dec 2015 10:43:12 +0000 (11:43 +0100)
committerRoza Moustafa <roza.92m@hotmail.com>
Thu, 3 Dec 2015 10:43:12 +0000 (11:43 +0100)
src/components/map/map.html
src/components/map/map.ts

index ec42aea..f64b914 100644 (file)
@@ -1,9 +1,6 @@
 <div id="map"></div>
 
-<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Small Modal</button>
-
-<span [hidden]="!visModal()">
-<div class="modal fade" id="myModal" role="dialog">
+<div id="divModal">
     <div class="modal-dialog modal-sm">
         <div class="modal-content">
             <div class="modal-header">
@@ -19,6 +16,4 @@
         </div>
     </div>
 </div>
-</span>
 
-</div>
\ No newline at end of file
index cbdb410..44127b8 100644 (file)
@@ -12,6 +12,7 @@ import {Headers, Http} from 'angular2/http';
 
 export class Map {
 
+    hideModal: any;
     map:Object;
     http:Http;
     LEVEL:number;
@@ -32,7 +33,11 @@ export class Map {
         this.parent = null;
         this.currentPos = null;
         this.uprunned = false;
+        this.hideModal = document.getElementById("divModal").style.visibility = "hidden";
+    }
 
+    showModal(){
+        return this.hideModal = document.getElementById("divModal").style.visibility = "visible";
     }
 
     getMap() {
@@ -203,10 +208,7 @@ export class Map {
                     instance.getData('/' + id + '/children', instance);
                 } else if (instance.runned == false && instance.LEVEL >= 4) {
                     instance.setRunned(true);
-                    let infowindowNew = new google.maps.InfoWindow({
-                        //TODO: Style this
-                        content: '<div>Du you want to add a new OrgUnit here ?    <button onclick="myFunction()">Yes</button></div>'
-                    });
+
                     instance.setcurrentPos(event.latLng);
 
                     var marker = new google.maps.Marker({
@@ -222,12 +224,8 @@ export class Map {
 
                     marker.setMap(instance.map);
 
-                    infowindowNew.open(instance.map, marker);
+                    instance.showModal();
 
-                    infowindowNew.addListener('closeclick', function (e) {
-                        instance.setRunned(false);
-                        marker.setMap(null);
-                    });
 
                     instance.addUnit();
 
@@ -271,10 +269,6 @@ export class Map {
 
     }
 
-    visModal(){
-            return true;
-    }
-
     addUnit() {
         let parent = this.getParent();
         let pos = this.getcurrentPos();