Error: [$interpolate:interr]$interpolate/interr? and $sce

leave a comment »

 When trying to load an iframe with url value fetched from controller, interpolate error occured as follows,

Error: [$interpolate:interr]$interpolate/interr?p0=%7B%7BembedUrl%7D…
  at Error (native)
  at v (
  at Object. (
  at n.$digest (
  at n.$apply (
  at Object.e [as invoke] (
  at d (

 Interpolate means , to alter/corrupt by adding something new. Angular assumed url loaded in iframe to be a corrupt one.

 This problem can be solved by using $sce service(Strict Contextual Escaping) with which we can mark the object(url) as safe.

app.controller("DemoController", function ($scope,$sce) {

  In the above code, url that has to be fetched in iframe is passed through $sce.trustAsResourceUrl(url). It returns an object that is trusted by angular which can further be used in ng-src.

 Did you know that, the above problem can also be solved by whitelisting url.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: