0

Say you have:

pre: function preLink(scope, element, attrs) {
  element.append('<div id="foo">foo</div>');
}

... and then you want to get a handle on the new foo element.

How is that possible?

Currently I have to run $compile on it, assign a directive to the div, and access it that way.

1 Answer 1

1

Something like this you mean?

var demo = angular.element('<div id="foo">foo</div>');
demo.bind('click', scope.clickingCallback);
element.append(demo);
Sign up to request clarification or add additional context in comments.

1 Comment

Exactly. Create the element, then add it. Thanks.

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.