Last active
August 29, 2015 14:12
-
-
Save joshbuchea/5aa780b818a97d713247 to your computer and use it in GitHub Desktop.
AngularJS Trusted Resource Filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.filter('trusted', ['$sce', function ($sce) { | |
return function(url) { | |
return $sce.trustAsResourceUrl(url); | |
}; | |
}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If Strict Contextual Escaping (SCE) is enabled in your AngularJS app, you will need to whitelist the URL or wrap the URL with a call to $sce.trustAsResourceUrl. This filter is convenient way of wrapping the URL.
In your templates: