X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=ang%2FcrmUi.js;h=f80ce39f18b6e6eafe391e89f4fb119d7e2f13d8;hb=4f87ec96e8ba594ad1705a8806999bd0bc976bb0;hp=23579fccbd0dc3aa442658273cd0734088bff7ac;hpb=a471fc404d2f8499128aa9f25d9cb25b3039e085;p=civicrm-core.git diff --git a/ang/crmUi.js b/ang/crmUi.js index 23579fccbd..f80ce39f18 100644 --- a/ang/crmUi.js +++ b/ang/crmUi.js @@ -314,10 +314,12 @@ // Display an HTML blurb inside an IFRAME. // example: + // example: .directive('crmUiIframe', function ($parse) { return { scope: { - crmUiIframe: '@' // expression which evalutes to HTML content + crmUiIframeSrc: '@', // expression which evaluates to a URL + crmUiIframe: '@' // expression which evaluates to HTML content }, link: function (scope, elm, attrs) { var iframe = $(elm)[0]; @@ -325,20 +327,24 @@ iframe.setAttribute('frameborder', '0'); var refresh = function () { - // var iframeHtml = ''; - var iframeHtml = scope.$parent.$eval(attrs.crmUiIframe); - - var doc = iframe.document; - if (iframe.contentDocument) { - doc = iframe.contentDocument; - } - else if (iframe.contentWindow) { - doc = iframe.contentWindow.document; + if (attrs.crmUiIframeSrc) { + iframe.setAttribute('src', scope.$parent.$eval(attrs.crmUiIframeSrc)); } + else { + var iframeHtml = scope.$parent.$eval(attrs.crmUiIframe); - doc.open(); - doc.writeln(iframeHtml); - doc.close(); + var doc = iframe.document; + if (iframe.contentDocument) { + doc = iframe.contentDocument; + } + else if (iframe.contentWindow) { + doc = iframe.contentWindow.document; + } + + doc.open(); + doc.writeln(iframeHtml); + doc.close(); + } }; // If the iframe is in a dialog, respond to resize events