0

I am creating a custom AngularJS directive, and when I want to use DI from directive function ($parse service in this case), I cannot retrieve it:

enter image description here

This seems to me weird, because my code is here very similar to the provided documentation on custom directive: https://docs.angularjs.org/guide/directive chapter "Creating a Directive that Manipulates the DOM" for example

Am i doing something wrong ??...

Thanks

0

1 Answer 1

2

You are seeing this ReferenceError because $parse is a closured variable from the parent scope ( it's parent function ), but it is not being used inside your link function, therefore it has been optimized away the moment you break there, and is no longer available for inspection.

If you assign $parse to a variable inside the link function you can inspect / use it. Try that and then see where you get stuck.

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

1 Comment

Well done, this was exactly the issue! $parse wasn't used and has been optimized. Thanks a lot

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.