0
在鏈接功能中,您可以訪問實例元素。你如何將它轉換成jQuery對象?如何將Angular實例元素轉換爲jQuery對象?
.directive('responsiveHeight', function() {
return {
restrict: 'A',
link: function(scope, iEl, attrs) {
iEl.bind('', function() { // what event to do this on?
scope.$apply(function() {
var width = $(iEl).width();
$(iEl).css({'height': (width/1.77) + 'px'});
});
});
}
};
})