angular.module('myApp.directives', []) .directive('mjpeg', function() { return { restrict: 'E', replace: true, template:'', scope: { 'url': '=' }, link: function (scope, element, attrs) { scope.$watch('url', function (newVal, oldVal) { if (newVal) { var iframe = document.createElement('iframe'); iframe.setAttribute('width', '100%'); iframe.setAttribute('frameborder', '0'); iframe.setAttribute('scrolling', 'no'); element.replaceWith(iframe); var iframeHtml = '