angularjs google map markers+ ui-gmap-windows --->增加click 事件
jsp:
<div class="modal-body viewOnMap">
<div class="cboxClose" ng-click="fn.close()">close</div>
<div class="mgt-20">
<ui-gmap-google-map center="map.center" zoom="map.zoom" draggable="true" options="options" bounds="map.bounds" >
<ui-gmap-markers models="randomMarkers" coords="'self'" icon="'icon'" click="'onClicked'" >
<ui-gmap-windows show="showWindow">
<div ng-controller="infoWindowCtrl">
<a ng-click="showInfo()">Contact Info</a><hr class="mgt-5 mgb-5" ng-non-bindable/>
<a ng-click="showInfo()">Contact Address</a><hr class="mgt-0 mgb-5" ng-non-bindable/>
<a ng-click="showInfo()">Other</a>
<!--<span ng-click="showInfo()">Contact Info</span><hr class="mgt-0 mgb-0" ng-non-bindable/>
<span ng-click="showInfo()">Contact Address</span><hr class="mgt-0 mgb-0" ng-non-bindable/>
<span ng-click="showInfo()">Other</span>-->
</div>
</ui-gmap-windows>
</ui-gmap-markers>
</ui-gmap-google-map>
</div>
</div> js:
.controller('viewOnMapInfoCtrl',['$scope','$rootScope','NiHttp','NiDialog','$timeout','order','latlng','uiGmapIsReady',function($scope,$rootScope,NiHttp,NiDialog,$timeout,order,latlng,uiGmapIsReady){
var vm = $scope.vm = {};
var fn = $scope.fn = {}; fn.close=function(){
NiDialog.close();
}
if(order!=null && latlng==null){
var srcOpt = {
url: '/orderHistory/findLeadsByOrderCode',
data: {orderCode:order.orderCode}
};
NiHttp.postForm(srcOpt)
.success(function(data){
console.log(_.uniq(_.pluck(data.result,'coordinate')));
vm.coordinate=_.uniq(_.pluck(data.result,'coordinate'));
})
}
if(order==null && latlng!=null){
vm.coordinate=latlng;
}
$timeout(function () {
$scope.map = {
center: {
latitude: latlng[0].split(',')[0],
longitude: latlng[0].split(',')[1]
},
zoom: 13,
bounds: {}
};
$scope.options = {
scrollwheel: true
};
var createRandomMarker = function(i, bounds,latitude,longitude,idKey) { if (idKey == null) {
idKey = "id";
} var ret = {
latitude: latitude,
longitude: longitude,
title: 'm' + i,
showWindow: false,
coords: {
latitude: latitude,
longitude: longitude
},
};
ret[idKey] = i;
return ret;
};
$scope.randomMarkers = [];
// Get the bounds from the map once it's loaded
$scope.$watch(function() {
return $scope.map.bounds;
}, function(nv, ov) {
// Only need to regenerate once
if (!ov.southwest && nv.southwest) {
var markers = [];
_.forEach(vm.coordinate,function(item,key){
var latlng=item.split(',');
console.log(latlng);
markers.push(createRandomMarker(key, $scope.map.bounds,latlng[0],latlng[1]));
})
$scope.randomMarkers = markers;
}
}, true);
_.each($scope.randomMarkers, function (marker) {
marker.closeClick = function () {
marker.showWindow = false;
$scope.$apply();
};
marker.onClicked = function () {
$scope.onMarkerClicked(marker);
};
});
}, 0); var markerToClose = null;
$scope.onMarkerClicked = function (marker) {
markerToClose = marker; // for next go around
marker.showWindow = true;
$scope.$apply();
}; }])
.controller('infoWindowCtrl', function($scope) {
$scope.showInfo = function() {
console.log('Button clicked!');
}
})
angularjs google map markers+ ui-gmap-windows --->增加click 事件的更多相关文章
- angularjs google map
google map display incorrect To remove the grayness, according to https://angular-ui.github.io/angul ...
- javascript google map circle radius_changed ,angularjs google map circle radius_changed
javascript: var cityCircle = new google.maps.Circle({ strokeColor: '#FF0000', strokeOpacity: 0.8, st ...
- Google map markers
现已被屏蔽 http://mabp.kiev.ua/2010/01/12/google-map-markers/ Надо по немногу отходить от празднывания но ...
- IView 给Submenu增加click事件失效解决方案
在浏览器中,打开开发者选项(F12) 找出对应的class,给其添加一个点击事件,就可以了. 具体的 document 操作,看这里 ----> https://www.cnblogs.co ...
- select选择option时触发的click事件google不兼容问题
原先的方式,下面代码编写的问题在google浏览器下是触发不了click事件的,具体缘由不清楚,反正都可以概括为不兼容了 碰到问题时,百度到的一篇解决:http://blog.163.com/rihu ...
- Google Map API 应用实例说明
目录 Google Map API 1基础知识 1.1 Google 地图 API 概念 1.2 Google 地图的"Hello, World" 1.2.1 加载 Google ...
- JavaFX結合 JDBC, Servlet, Swing, Google Map及動態產生比例圖 (2):JavaFX建立及程式碼說明 (转帖)
說明:就如同標題一樣,前端會用到JavaFX.Swing.Java Web Start.Google Map 的技術, 後端就是JDBC.Servlet的技術,以及我們會簽署認證jar檔案,這樣才可存 ...
- Google Map Api 谷歌地图接口整理
一:基本知识: 1. 使用谷歌地图 API 的第一步就是要注册一个 API 密钥,需要注重一下两点: 1.假如使用 API 的页面还没有发布,只是在本地调试,可以不用密钥,随便用个字符串代替就可以了. ...
- Google Map API v2 步步为营(一) ----- 初见地图
官方文档:https://developers.google.com/maps/documentation/android/start?hl=zh-CN 先谷歌后百度.使用google的api基本上按 ...
随机推荐
- Hibernate Is Not Mapped(实体名 is not mapped [from book where id='0'])
org.springframework.orm.hibernate3.HibernateQueryException: USERINFO is not mapped.看到.hbm.xml文件中的< ...
- HTML+js+css实现点击图片弹出上传文件窗口的两种思路
第一种:CSS实现 <style><!-- .fileInputContainer{ height:256px; background:url(upfil ...
- 查看SGA和PGA使用率
select name,total,round(total-free,2) used, round(free,2) free,round((total-free)/total*100,2) pctus ...
- BZOJ1610: [Usaco2008 Feb]Line连线游戏
1610: [Usaco2008 Feb]Line连线游戏 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 1301 Solved: 571[Submit ...
- 2015第42周六Pgsql全文索引
全文搜索通常也就是文本搜索,它可以提供满足查询的识别自然语言的能力,并且任意性地通过相关性查询进行排序.搜索最常见的类型就是找到所有包含给定的查询术语的记录,并且以相似性的查询顺序返回它们. 对于普通 ...
- %3A%2F%2F这样的叫什么码啊?
%3A -> 3A -> 16*3+10 -> 58 -> chr(58) = ":"%2F -> 2F -> 16*2+15 -> 47 ...
- 网络流(最大流):CodeForces 499E Array and Operations
You have written on a piece of paper an array of n positive integers a[1], a[2], ..., a[n] and m goo ...
- 20140704笔试面试总结(java)
1.java数组定义 1.与其他高级语言不同,Java在数组声明时并不为数组分配存储空间,因此,在声明的[]中不能指出数组的长度 2.为数组分配空间的两种方法:数组初始化和使用new运算符 3.未分配 ...
- 怎样打开64位 Ubuntu 的32位支持功能?
怎样打开64位 Ubuntu 的32位支持功能? 现在有一个让你可以在64位系统中使用32位软件的方法,就在你读了这篇文章然后照着做了之后就可以了.如果你有一个13.10或更高版本的Ubuntu/De ...
- ASP.net:截取固定长度字符串显示在页面,多余部分显示为省略号
方法一: public static string GetString(string str, int length) { int i = 0, j = 0; foreach(char chr in ...