SO - 15199067

by Arun P Johny

HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div ng-app="test">
<hello>
    <img id="marker" src="http://maps.google.com/mapfiles/ms/micons/blue.png" style="display: none; position: absolute;" />
</hello>
</div>

JavaScript

angular.module('test', []).directive('hello', function() {
	return {
		restrict : 'E',
        template : '<div style="position: relative"><img id="map" src="http://www.lonelyplanet.com/maps/asia/india/map_of_india.jpg"  /><img id="marker" src="http://maps.google.com/mapfiles/ms/micons/blue.png" style="display: none; position: absolute;" /></div>',
        replace: true,
		link : function(scope, element, attrs) {
			$('#map').click(function(e) {
						$('#marker').css('left', e.pageX).css('top', e.pageY)
								.show();
					});
		}
	};
})