Skip to content

Commit 118fb5c

Browse files
committed
declarative events settings now eval and pass directly to options ( instead of .on() handler )
1 parent 76db55e commit 118fb5c

File tree

1 file changed

+9
-26
lines changed

1 file changed

+9
-26
lines changed

src/igniteui-angular.js

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -289,40 +289,23 @@
289289
function extractOptions(nodeName, context, options, element, scope) {
290290
//extract all options from the element
291291
var i, name, value, optionName, children = context.children,
292-
attrs = context.attributes, eventName, eventAttrPrefix = "event-";
292+
attrs = context.attributes, eventAttrPrefix = "event-";
293293

294294
for (i = 0; i < attrs.length; i++) {
295295
name = attrs[i].name;
296296
value = attrs[i].value;
297297

298298
if (name.startsWith(eventAttrPrefix)) {
299-
name = name.substr(eventAttrPrefix.length).replace(/-/g, "").toLowerCase();
300-
301-
if (name.startsWith(nodeName.toLowerCase())) {
302-
eventName = name;
303-
} else {
304-
305-
// for grid features we also need to prefix the feature name to the event name
306-
// for instance: iggridselectionrowselectionchanged
307-
var featureName = "";
308-
309-
if (attrs.name) {
310-
featureName = attrs.name.nodeValue.toLowerCase();
311-
}
312-
313-
eventName = nodeName.toLowerCase() + featureName + name;
314-
}
315-
316-
element.on(eventName, scope.$eval(value));
317-
} else {
318-
name = convertToCamelCase(name);
299+
name = name.substr(eventAttrPrefix.length);
300+
value = scope.$eval(value) || value;
301+
}
302+
name = convertToCamelCase(name);
319303

320-
/* if somewhere in the controls there is floting point number use this one /^-?\d+\.?\d*$/ */
321-
if (value === "true" || value === "false" || /^-?\d+\.?\d*$/.test(value) || /^{{[^}]+}}$/.test(value)) {
322-
value = scope.$eval(value.replace(/([{}:])\1/g, ""));
323-
}
324-
options[name] = value;
304+
/* if somewhere in the controls there is floting point number use this one /^-?\d+\.?\d*$/ */
305+
if (value === "true" || value === "false" || /^-?\d+\.?\d*$/.test(value) || /^{{[^}]+}}$/.test(value)) {
306+
value = scope.$eval(value.replace(/([{}:])\1/g, ""));
325307
}
308+
options[name] = value;
326309
}
327310
//extract options from the nested elements
328311
for (i = 0; i < children.length; i++) {

0 commit comments

Comments
 (0)