0

Given an AngularJS module, there are two functions defined in it, functionA and functionB. How to call functionA from functionB?

app.service('myService', [

    function() {

        module = {

            functionA: function() {   ...   },

            functionB: function() {   

                // call functionA

            }

        }

        return module;
    }
]);
1
  • @Jack no that doesn't work. Commented Aug 13, 2014 at 7:54

1 Answer 1

0

I figured it out. As the function is under the module scope (module = {) it has to be referred with the scope name i.e.

module.functionA
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.