SO #33760504

http://angularjs.org/

by masa671

HTML

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0-beta.1/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0-beta.1/angular-sanitize.js"></script>
<div ng-controller="MyCtrl">
    <p>Check the contents of the green element with browser dev tools:</p>
    <div bind-html-compile="phpData"></div>
    <p>--end--<p>
</div>

JavaScript

var myApp = angular
	.module('myApp',['ngSanitize'])
	.controller('MyCtrl', function ($scope, $sce) {
        
        var phpResp = '<video data-html5-video="{{generateVideoFolder($index)}}" data-controls="true" data-preload="false" data-width="400" data-height="224" style="background-color: green;"></video>';
        
        $scope.phpData = $sce.trustAsHtml(phpResp);
        
        $scope.generateVideoFolder = function ($index) {
            return 'some-content';
        };
    })
    .directive('bindHtmlCompile', ['$compile', function ($compile) {
        return {
            restrict: 'A',
            link: function (scope, element, attrs) {
                scope.$watch(function () {
                    return scope.$eval(attrs.bindHtmlCompile);
                }, function (value) {
                    element.html(value);
                    $compile(element.contents())(scope);
                });
            }
        };
    }]);