- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Angular 我将awesomeThing.name设置为base64数据
我想读入。
我试过了:
'use strict'
angular.module 'papaApp'
.config [
"$compileProvider"
($compileProvider) ->
$compileProvider.aHrefSanitizationWhitelist /^\s*(https?|ftp|mailto|data):/
]
.controller 'MainCtrl', ['$scope', '$http', 'socket', '$sce', ($scope, $http, socket, $sce) ->
$scope.awesomeThings = []
$http.get('/api/things').success (awesomeThings) ->
$scope.awesomeThings = awesomeThings
socket.syncUpdates 'thing', $scope.awesomeThings
for awesomeThing in $scope.awesomeThings
$sce.trustAsResourceUrl awesomeThing.name
$scope.addThing = ->
return if $scope.newThing is ''
$http.post '/api/things',
name: $scope.newThing
$scope.newThing = ''
$scope.deleteThing = (thing) ->
$http.delete '/api/things/' + thing._id
$scope.$on '$destroy', ->
socket.unsyncUpdates 'thing'
]
Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy. URL: data:audio/mp3;base64,//sQxAADwAABpAAAACAAADSAAAAE8cGnkAH+AOE/hcIGJPyWA8gso…VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ==
最佳答案
自己找出来
读完这个Angular JS Handling Ng-Repeated HTML5 Video & $SCE之后
angular.module 'papaApp'
.config ($sceDelegateProvider) ->
$sceDelegateProvider.resourceUrlWhitelist [
# Allow same origin resource loads.
"self"
# Allow loading from our assets domain. Notice the difference between * and **.
"data:**"
]
return
.controller 'MainCtrl', ($scope, $http, socket) ->
$scope.awesomeThings = []
$http.get('/api/things').success (awesomeThings) ->
$scope.awesomeThings = awesomeThings
socket.syncUpdates 'thing', $scope.awesomeThings
$scope.addThing = ->
return if $scope.newThing is ''
$http.post '/api/things',
name: $scope.newThing
$scope.newThing = ''
$scope.deleteThing = (thing) ->
$http.delete '/api/things/' + thing._id
$scope.$on '$destroy', ->
socket.unsyncUpdates 'thing'
关于angularjs - Angular $ sce阻止了我的音频src,尝试了$ sce.trustAsResourceUrl,但仍然出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26554674/
我正在尝试使用$ sce。我像这样设置我的代码: var app = angular .module('app', ['ui.router', 'admin', 'home', 'questi
我正在使用联合客户端体验 (SCE) SDK。有没有人为此成功创建自定义数据馈送?我希望能够在 URL 上托管 masterfeed 和其他提要,而不是像示例那样编译为嵌入式资源。例如,客户端应用程序
如果我完全禁用 $sce 服务会发生什么坏事? angular.module('app').config(function ($sceProvider) { $sceProvider.enab
好的,所以我在代码中测试过的以下内容有效: javascript: var string = 'hello'; $scope.html = $sce.trustAsHtml(string); html
在我的 Web 应用程序中,我给出了一个用 angular $sce 包装的对象。在这个对象中,每个属性都有一个特殊的属性 $$unwrappedTrusted 但它并没有真正给我对象值。我怎样才能获
我在这里添加了一个 Plunker:http://plnkr.co/edit/4vqV8toHo0vNjtfICtzI?p=preview 我正在尝试向 DOM 添加一个按钮,单击时应该执行绑定(bi
我正在尝试在字符串上运行 $sce.trustAsHtml 。它抛出 Error: $sce:itypeString Value is Required for SCE Trust Call即使我在返
我得到:阻止从 $sceDelegate 策略不允许的 url 加载资源。网址://www.youtube.com/embed/61aM0DXpKkc 在下面 table, th , td {
我正在尝试访问成功返回PDF文档的API。我正在使用$ sce.trustAsResourceUrl从我的HTML代码中调用此API。 如果失败,此 getStatement API将返回JOSN错误
我怎样才能做这样的事情:$sce.trustAsResourceUrl('URL_HERE'); 全局范围内,例如主应用的 config() 或 run() 函数,以便任何具有 URL_HERE 的
假设以下字符串: Hello World 我只想允许粗体元素工作,而斜体元素(以及任何其他元素!)保持不变,因此输出为: Hello World 。 目前我使用: function outputHtm
我有一个像这样的变量:- tableData1[$scope.tableHeadingsConstant[0]] = $sce.trustAsHtml(''
我有一个警报如下: $scope.addAlert('danger', $sce.trustAsHtml('Invalid Alias Name: Certain limitations apply
我只是想播放/暂停其他地方的音频流。 最初我遇到了SCE错误。然后找到并尝试了不同答案的解决方案。 那些使SCE错误消失了,但是音频仍然无法正常工作。 我的第一次尝试是使用过滤器,如下所示: Angu
我正在尝试使用 angularjs 创建一个应用程序,其中输入是从输入框中获取并显示的。这类似于聊天。因此输入可以包含 url,我在 Autolinker.js 的帮助下将它们转换为链接。我在这个问题
这是我正在尝试做的事情 $sce.trustAsHtml('') 在我的 HTML 代码中只打印 但我期待ng-class $sce之前要评估的属性返回它。我的代码有点像这样工作 如何做到这一点?
我知道 $sce.trustAsHtml() 可以让 AngularJS 按原样显示 HTML。经过一番坐立不安后,我意识到这并不适用于所有情况。特别是当该数据中包含其他标签时。 如果我使用简单的 H
我正在尝试将字符串解析为字符数组,用 包围每个字符。 。提交解析的函数有效,每个字符都被 包围标签。解析函数: app.controller('tableCtrl',function($scope
我是 AngularJS 的新手。我尝试将 iframe src 与 Angular Controller 绑定(bind)。 html: Controller js: $scope.iframeU
我必须呈现一个字符串 (item.tabs.review.content),使用 $sce.trustAsHtml 将其解析为 HTML。 我遇到的主要问题是在字符串中引用了项目对象 (item.ta
我是一名优秀的程序员,十分优秀!