मैं इस निर्देश में प्रत्येक div करने के लिए एक अद्वितीय ID को जोड़ने के लिए है, ताकि मैं क्या तत्व निर्दिष्ट कर सकते हैं कि गूगल मैप्स पास करना चाहिए हैं:निर्देश के प्रत्येक उदाहरण में आप एक अद्वितीय आईडी कैसे जोड़ सकते हैं?
directive('gMap', function(googleMaps){
return{
restrict: 'E',
replace: true,
transclude: true,
template: "<div id="{{unique_ID}}"></div><div ng-transclude></div>",
scope: true,
link: function(scope, element, attrs){
//create the map
var center = googleMaps.makePosition(attrs.centerlat, attrs.centerlong)
//update map on load
var options = googleMaps.setMapOptions(center, attrs.zoom);
scope.map = googleMaps.createMap(options, unique_id)
},
};
}).
[तत्वों के लिए निर्देशक टेम्पलेट अद्वितीय आईडी] की संभावित डुप्लिकेट (http://stackoverflow.com/questions/21021951/directive-template-unique-ids-for-elements) –