Having some trouble embedding a YouTube video into my website using AngularJS. Keep receiving this pesky error:
Error: $interpolate:interr Interpolation Error
Any idea why this error is popping up and how I can resolve it? Just trying to add the video...
App.js
var myApp = angular.module('myApp', [
'duScroll', 'duParallax', 'angularFileUpload', 'ngRoute', 'ngSanitize'
]);
myApp.filter('youtube', ['$sce', function($sce) {
return function(val) {
var videoLink = val;
var watch = val.indexOf("?v=") + 3;
var playlist = val.indexOf('&') + 1;
if (playlist > 0) {
return $sce.getTrustedResourceUrl('//www.youtube.com/embed/' + val.substring(watch, playlist));
} else {
return $sce.getTrustedResourceUrl('//www.youtube.com/embed/' + val.substring(watch, videoLink.length));
}
};
}]);
index.jade
iframe(ng-if="story.media.video" src="{{ story.media.video | youtube }}" frameborder="0" allowfullscreen)