0

I have a directive that has an attirbute, it looks like this:

<directive config="myConfig"></directive>

This is my directives code:

app.directive("directive", ["$compile", ($compile) => {
    return {
      scope: {"config":"="},
      template: "<div></div>",
      link: function(s,e,a) {
        // I want my scope here so I could use $compile to compile a directive into it
        // ('it' being the scope the directive lives in).
        // Yet I also want the config variable so I could $watch it.
      }
    }
});  

As shown, I want the config variable and the entire scope, is there a way to do this?
Thanks.

1 Answer 1

1

Don't use isolated scope then. just add config to the parent scope, and the directive directive could watch it since it is on the same scope. your new directive (the one you want to compile) could have an isolated scope.

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.