Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

$compile isn't available on every DOM element #3

Description

@stephanrauh

I observed an error message on this line:

var $compile = angular.element(document).injector().get('$compile')

Requesting the injector() specifically from the controller element does the trick for me:

var theInjector = angular.element(document.querySelector('[ng-controller]')).injector();
var $compile = theInjector.get('$compile');

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions