I would like to send JSON object with function template from app.controller to another directive controller. I decided to send this variable as attribute of inner directive's element. The problem is that object which is inside $attr.valueAtt in my directive controller is "[object Object]" and I can't get it:
My code:
var value = (
[{
functionLabel:'Fun',
functionTemplate: function(param1,param2){
alert(param1);
},
functionParams: ['PARAM1','PARAM2']
}]);
Then I add it in controller as attribute of directive element:
angular.element(document.getElementById('space-for-modals'))
.append($compile("<modal-dialog visible='true' data-backdrop='static' valueAtt='"+value+"'></<modal-dialog>")($scope));
And try to get "value" in my directive controller:
$scope.functions= $attrs.valueAtt;
But in $scope.functions is only "[object Object]". Is there any way to send function template from one to another controller to call it later?