4

I am trying to load a map on each page that is specific to the values from an api, but I am getting this error message:

Strict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce http://errors.angularjs.org/1.2.15/$interpolate/noconcat?

Here is the markup:

<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>

and here is the controller:

.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);

1 Answer 1

0

Instead of using $sce.trustAsHtml(), try using $sce.trustAsResourceUrl(). Place your whole URL as parameter for $sce.trustAsResourceUrl(). The link below worked for me.

How to set an iframe src attribute from a variable in AngularJS

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.