I\'m trying to pass a callback function from a controller to a directive.
Here\'s the callback function code:
$scope.onImageSelect = function(image)
Following code is tested and working..
Directive call in html
Sample Directive code
{
scope:'&',
link: function (scope, element, attrs) {
scope.tax = {amount:12, rate:10.50};
scope.obj = {number:12, value:10};
scope.call_back = function (tax) {
scope.callBackFun({a:tax, b:obj});
}
}
}
Sample Controller
app.controller("sample", function($scope){
$scope.calculate_tax = function (tax, obj) {
console.log("tax "+JSON.stringify(tax));
console.log("obj "+JSON.stringify(obj));
}
});