user1272965 user1272965 - 9 months ago 257
AngularJS Question

Use $compileProvider to avoid unsafe links

I have no trouble injecting things like $scope and $location and $routeProvider, why is $compileProvider different?

Based on this answer, I understand that I have to instruct angular to not prefix certain links (sms in my case), but I can't apply the answer in my project. It says I should add this:

angular.module('myModule', [], function ($compileProvider) {

But the chrome console says:

"angular.js:68 Uncaught Error: [$injector:unpr] Unknown provider:
$compileProviderProvider <- $compileProvider"

That "provider-provider" thing made me think that the real name of the service is just $compile (and that angular is tacking on the "provider" suffix:

angular.module('myModule', [], function ($compile) {

But then, predictably, I guess, I get:

angular.js:13550 TypeError: $compile.aHrefSanitizationWhitelist is not a function


That's because you have to add it as a config:

  function($compileProvider) {