angularjs expression in html <object> tag

后端 未结 5 2285
感情败类
感情败类 2020-12-03 03:42

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:



        
5条回答
  •  借酒劲吻你
    2020-12-03 04:11

    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('' +
                            'Для просмотра pdf:
    Для Internet Explorer установите Acrobat Reader
    ' + 'Для Chrome: Проверьте настройки' + '
    '); $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

提交回复
热议问题