0

I want to pass a function that returns a promise into my directive. Currently I am doing as follows:

Callback created in parent controller:

$scope.myCb = function(data) {
   console.log(data);
}

Scope of Directive:

scope {
    dataCallback: "&"
}

It is being passed to the directive as follows:

<my-directive data-callback="createCallback"></div>

And it is being called in the directive controller as follows:

$scope.dataCallback(data)

where data is a local variable.

Currently this is not working. The $scope.dataCallback is returning parentGet(scope, locals) and is not executing any of the code inside of the function.

Can anyone help point me in the right direction?

https://plnkr.co/edit/ycgFpurlt2MFupPI1LZJ?p=preview

2

1 Answer 1

1

Solved:

Can not use data as start of directive property.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.