Reputation: 135
This is my code snippet -
<my-wizard
on-finish="doFinish()"
I am calling on-finish from my-wizard's controller class. It works and doFinish() gets invokes. I want to pass some parameters to doFinish() from the directive controller. What is the way for it?
This is my-wizard directive -
app.directive('myWizard', function () {
return {
restrict: 'EA',
replace: true,
transclude: true,
scope: {
onFinish: '&',
...
}
}
Upvotes: 0
Views: 101
Reputation: 546
Where is your onFinish() method getting called?
just pass some data to it in the shape of an object
onFinish({someData: data})
Then retrieve it using the same name of the object property:
function doFinish(someData) {
console.log(someData)
}
The directive definition should also cater the passed argument:
<my-wizard
on-finish="doFinish(someData)"
Upvotes: 1