我正在尝试在每个页面上加载特定于api值的映射,但是我收到此错误消息:
Strict Contextual Escaping禁止在需要可信值时连接多个表达式的插值。见http://docs.angularjs.org/api/ng。$ sce http://errors.angularjs.org/1.2.15/ $插值/ noconcat?
这是标记:
<div ng-bind-html="trustedHtml" class="col-md-4 map">
<iframe ng-src="https://www.google.com/maps/embed/v1/placekey=AIzaSyAJ_lVIxNq31PmzRUbMh9JIStQOE4_6-aQ&q='{{event.venue.name}}'"/>
</div>
这是控制器:
.controller('EventsCtrl', function($scope, EventsFactory, $routeParams, $sce){
EventsFactory.async().then(function(data){
$scope.events = data.data;
$scope.event= findEvent(eventId, $scope.events);
console.log($scope.event);
$scope.trustedHtml = $sce.trustAsHtml($scope.event);
答案 0 :(得分:0)
请尝试使用if (actionFirstSplit[1].equals("LOAD"))
,而不要使用$sce.trustAsHtml()
。将整个网址作为$sce.trustAsResourceUrl()
的参数。下面的链接对我有用。
How to set an iframe src attribute from a variable in AngularJS