Angularjs:<iframe>没有在partials </iframe>中加载源页面的CSS

时间:2014-07-03 07:37:22

标签: javascript css angularjs iframe partials

我正在使用&lt; \ iframe&gt;在局部。它可以加载源页面,但CSS不会加载到内部页面中。这是我的代码:

all_widget.html

<div class="container">
  <iframe src="./templates/widget_2.html" my-iframe></iframe>
</div>

directives.js

app.directive('myIframe', function() {
  var linkFn = function(scope, element, attrs) {
    element.find('iframe').bind('load', function(event) {
        event.target.contentWindow.scrollTo(0, 400);
    });
  };
  return {
    restrict: 'EA',
    scope: {
        src: '@src',
        height: '@height',
        width: '@width',
        scrolling: '@scrolling'
    },
    template: '<iframe class="frame" height="{{height}}" width="{{width}}" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="{{scrolling}}" src="{{src}}"></iframe>',
    link: linkFn
  };
});

0 个答案:

没有答案
相关问题