我有以下代碼:
<span ng-include="getHeaderTemplate()"></span>
getHeaderTemplate()返回 「模板/頭/ prospection.html」
然而,我得到的以下錯誤:
Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy. URL: templates/header/prospection.html
http://errors.angularjs.org/1.2.9/$sce/insecurl?p0=templates%2Fheader%2Fprospection.html
at http://localhost/piquick/laravel/public/vendor/angular-1.2.9.js:78:12
at Object.getTrusted (http://localhost/piquick/laravel/public/vendor/angular-1.2.9.js:12739:17)
at Object.sceParseAsTrusted (http://localhost/piquick/laravel/public/vendor/angular-1.2.9.js:13168:22)
at Scope.$digest (http://localhost/piquick/laravel/public/vendor/angular-1.2.9.js:11800:40)
at Scope.$apply (http://localhost/piquick/laravel/public/vendor/angular-1.2.9.js:12061:24)
at http://localhost/piquick/laravel/public/vendor/angular-1.2.9.js:1302:15
at Object.invoke (http://localhost/piquick/laravel/public/vendor/angular-1.2.9.js:3710:17)
at doBootstrap (http://localhost/piquick/laravel/public/vendor/angular-1.2.9.js:1300:14)
at bootstrap (http://localhost/piquick/laravel/public/vendor/angular-1.2.9.js:1314:12)
at angularInit (http://localhost/piquick/laravel/public/vendor/angular-1.2.9.js:1263:5)
的URL是在同一臺服務器(這是一個本地URL),所以我不明白爲什麼我得到這個錯誤。
這裏的約$ SCE
http://docs.angularjs.org/api/ng.$sce#resourceurlpatternitem
我不明白爲什麼'templates/header/prospection.html'不適合CORS。這是一個本地URL,所以他們不應該有任何問題。 – edi9999
不確定我自己。我認爲瀏覽器政策的某些方面是關閉的?雖然我的建議能起作用嗎? – Stuart
沒有,仍然是相同的錯誤 – edi9999