0

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: '&',
           ...
           }
        }
3
  • what is on-finish, a directive? Can you elaborate a little in your question on the order of operations? I guess it would be helpful to get more context on how it works and how you want it to work Commented Apr 8, 2022 at 16:22
  • Added it in the question detail. Commented Apr 9, 2022 at 14:52
  • This might help: 3pillarglobal.com/insights/… Commented Apr 9, 2022 at 21:38

1 Answer 1

1

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)"
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.