I have a scope like $scope.doc_details in my angularjs controller, and I want to use it to display a pdf file by using a tag, like this:
Thank you satchmorun, but if smb want change link without reloading page or modal you can use:
And this directive:
app.directive('pdf2', ['$compile', function ($compile) {
return {
restrict: 'E',
scope: {
src: "=",
height: "="
},
link: function (scope, element, attr) {
function update(url) {
element.html('');
$compile(element.contents())(scope);
}
scope.$watch('src', update);
}
};
}]);
Thank you Jerry from this answer and example of recompile a dynamically loaded directive.
p.s. "pdfUrl" and "heightForPDF" are variable in scope