2017-07-26 10 views
0

https://jsfiddle.net/BRNTZN/05c1agtb/18/

HTML効果がありません

var app = angular.module('myapp', []); 

app.config(function($sceDelegateProvider) { 
    $sceDelegateProvider.resourceUrlWhitelist([ 
    'self', 
    'https://www.google.be/**' 
    ]); 
}); 

app.controller('mainctrl', function MainController($scope) { 
    $scope.query = "javascript"; 
}); 

フィドルの上記外をやって、私はコンソール内のjs次のエラーを取得します:

Error: [$interpolate:noconcat] http://errors.angularjs.org/1.5.6/$interpolate/noconcat?p0=https%3A%2F%2Fwww.google.be%2Fsearch%3Fq%3D%7B%7Bquery%7D%7D 
    at angular.js:38 
    at Function.Ka.throwNoconcat (angular.js:11887) 
    at k (angular.js:12193) 
    at ha (angular.js:9606) 
    at $b (angular.js:8553) 
    at s (angular.js:8378) 
    at s (angular.js:8394) 
    at s (angular.js:8394) 
    at aa (angular.js:8281) 
    at angular.js:1782 

リンクは以下の説明につながる:

Error while interpolating: https://www.google.be/search?q={{query}} 
Strict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce 

私のバイオリンによって証明されるように、私は「https://www.google.be/ **を」ホワイトリストしていますので、非常に奇妙ですどの。

ホワイトリストには何の効果もないのはなぜですか?

答えて

0

ng-srcは$ sceで動作しないと思います。バイイングでng-srcをng-bind-htmlに変更すると動作します。

<iframe ng-bind-html="https://www.google.be/search?q={{query}}"></iframe> 

https://jsfiddle.net/05c1agtb/19/

+0

これは確かに正しいHTMLがしかし、IFRAMEがまったくレンダリングされない、表示されるようありません。私はhttps://en.wikipedia.org/wiki/{{query}}を使って試してみましたが、これは実際にiframeをテストするためのより良いページです。 Googleのものはこれまでにiframeでレンダリングされません。 – BRNTZN

関連する問題