|
26 | 26 | } catch(e) { // if not parsable, change little
|
27 | 27 | return str
|
28 | 28 | // wrap keys without quote with valid double quote
|
29 |
| - .replace(/([\$\w]+)\s*:/g, function(_, $1){return '"'+$1+'":'}) |
| 29 | + .replace(/([\$\w]+)\s*:/g, function(_, $1){return '"'+$1+'":';}) |
30 | 30 | // replacing single quote wrapped ones to double quote
|
31 |
| - .replace(/'([^']+)'/g, function(_, $1){return '"'+$1+'"'}) |
| 31 | + .replace(/'([^']+)'/g, function(_, $1){return '"'+$1+'"';}); |
32 | 32 | }
|
33 | 33 | }
|
34 | 34 |
|
35 |
| - var Attr2Options = function($parse, $timeout, NavigatorGeolocation, GeoCoder) { |
| 35 | + var Attr2Options = function($parse, $timeout, $log, NavigatorGeolocation, GeoCoder) { |
36 | 36 |
|
37 | 37 | /**
|
38 | 38 | * Returns the attributes of an element as hash
|
|
128 | 128 | var getAttrsToObserve = function(attrs) {
|
129 | 129 | var attrsToObserve = [];
|
130 | 130 | if (attrs["ng-repeat"] || attrs.ngRepeat) { // if element is created by ng-repeat, don't observe any
|
131 |
| - void(0); |
132 |
| - } else { |
133 |
| - for (var attrName in attrs) { |
134 |
| - var attrValue = attrs[attrName]; |
135 |
| - if (attrValue && attrValue.match(/\{\{.*\}\}/)) { // if attr value is {{..}} |
136 |
| - console.log('setting attribute to observe', attrName, camelCase(attrName), attrValue); |
137 |
| - attrsToObserve.push(camelCase(attrName)); |
138 |
| - } |
| 131 | + $log.warn("It is NOT ideal to have many observers or watcher with ng-repeat. Please use it with your own risk"); |
| 132 | + } |
| 133 | + for (var attrName in attrs) { |
| 134 | + var attrValue = attrs[attrName]; |
| 135 | + if (attrValue && attrValue.match(/\{\{.*\}\}/)) { // if attr value is {{..}} |
| 136 | + console.log('setting attribute to observe', attrName, camelCase(attrName), attrValue); |
| 137 | + attrsToObserve.push(camelCase(attrName)); |
139 | 138 | }
|
140 | 139 | }
|
141 | 140 | return attrsToObserve;
|
|
284 | 283 | return str;
|
285 | 284 | }
|
286 | 285 | });
|
287 |
| - } |
288 |
| - |
| 286 | + } |
| 287 | + |
289 | 288 | if (key === "style") {
|
290 | 289 | var str = attr.charAt(0).toUpperCase() + attr.slice(1);
|
291 | 290 | var objName = str.replace(/Options$/,'')+"Style";
|
|
318 | 317 | orgAttributes: orgAttributes
|
319 | 318 | }; // return
|
320 | 319 |
|
321 |
| - }; |
322 |
| - Attr2Options.$inject= ['$parse', '$timeout', 'NavigatorGeolocation', 'GeoCoder']; |
| 320 | + }; |
| 321 | + Attr2Options.$inject= ['$parse', '$timeout', '$log', 'NavigatorGeolocation', 'GeoCoder']; |
323 | 322 |
|
324 | 323 | angular.module('ngMap').service('Attr2Options', Attr2Options);
|
325 | 324 | })();
|
0 commit comments