我正在使用< \ iframe>在局部。它可以加载源页面,但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
};
});