0

I have been trying to call method with argument in directives using angularjs 1.x.

I need to call a method call with argument num. I do not know how to pass that num argument to call method in directive.

myApp.directive('cccIrisRender', function () {
        restrict: 'AE',
        scope: {
            call:'&'
        },
templateUrl:'xyz.html',
controller:[$scope, function($scope){
   $scope.callMe = function(num){
     $scope.call(num);
   }
    }

        ]
    };
});
Vemonus
  • 868
  • 1
  • 16
  • 28
  • Can't you just say `$scope.callMe = $scope.call;`? Why do you even need `$scope.callMe`?. Your controller also should be `['$scope', ...]`, not `[$scope, ...]`. – cdhowie Jan 03 '17 at 17:18
  • Possible duplicate of [Pass callback function to directive](http://stackoverflow.com/questions/31440366/pass-callback-function-to-directive) – ach Jan 03 '17 at 17:19
  • Where is `num` coming from ? – Piou Jan 03 '17 at 17:20
  • How do you take the parameters in the assigned function to `call`? I think you can just pass it in a object as `$scope.call({data:num})` – code90 Jan 03 '17 at 17:47

0 Answers0