$document
Injectable
window.document objectDescription
An injectable wrapper for window.document
object . Useful for
mocking a browser dependency in non-browser environment tests:
Example:
// value injectables are overriden
angular.module('demo', []).value('$document', {});
When combined with ng-inject directive, the wrapper also makes document
object directly accessible in the template scope.
Demo
<section ng-app>
<div ng-inject="$document">
`document.location.host` == <b>{{ $document.location.host }}</b>
</div>
</section>
`document.location.host` == {{ $document.location.host }}
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.