0

I got an error of Error while interpolating: videos/{{video.name}} with below code :

<div ng-repeat='video in videos'>
        <div class="col-md-3">
        <video controls>
          <source src="videos/{{video.name}}" type="video/mp4">
          Your browser does not support HTML5 video.
        </video>
        {{video.name}} // this worked
        </div>
    </div>

Tried ng-src too but doesn't work. Strange.

2 Answers 2

2

Use this filter,

app.filter("trustUrl", ['$sce', function ($sce) {
        return function (recordingUrl) {
            return $sce.trustAsResourceUrl(recordingUrl);
        };
    }]);

HTML

    <video controls>
      <source src="videos/{{video.name | trustUrl}}" type="video/mp4">
      Your browser does not support HTML5 video.
    </video>
Sign up to request clarification or add additional context in comments.

4 Comments

video.name is just name like 'tarzen 2016 - something something'
ok then form the url using javascript and apply the trustUrl for entire url
[$interpolate:noconcat] Error while interpolating: videos/{{video.name}}
why did you remove the answer?
0

Try this :

Html :

<div ng-app="myApp" ng-controller="MyCtrl">
  <div ng-repeat='video in videos'>
        <div class="col-md-3">
        <video controls>
          <source src="videos/{{video.name}}" type="video/mp4">
          Your browser does not support HTML5 video.
        </video>
        {{video.name}} // this worked
        </div>
    </div>
</div>

JS :

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

myApp.controller('MyCtrl',function($scope) {
    $scope.videos = [
      {"name":"alpha"},
      {"name":"beta"},
      {"name":"gama"}
    ]
});

Working demo!

3 Comments

your 'working demo' is so big, but can the video be played?
Big means ? .. I dont know the exact streaming url but it will work. Its just a answer of your question and demo how to parse the controller data in view.
Actually this question is not easy, it's a bug in angularjs github.com/angular/angular.js/issues/1352

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.