lib/assets/javascripts/directives/ngcallback.coffee in material_raingular-0.0.2.7.1 vs lib/assets/javascripts/directives/ngcallback.coffee in material_raingular-0.0.3
- old
+ new
@@ -5,11 +5,12 @@
controller: ($scope,$element) ->
@evaluate = (returnData)->
for callback in $element[0].attributes['ng-callback'].value.split(';')
[match,func,args] = callback.match(/(.*)\((.*)\)/)
data = []
- for arg in args.split(',')
- data.push $scope.$eval(arg)
+ if !!args
+ for arg in args.split(',')
+ data.push $scope.$eval(arg)
data.push returnData
if typeof $scope[func] == 'function'
$scope[func] data...
else if typeof window[func] == 'function'
window[func] data...