how to set dynamically height to element?

后端 未结 4 2272
眼角桃花
眼角桃花 2021-02-19 03:18

I am trying to set dynamically height to element in my demo .I will tell you issue I am taking static or constant value of height in my demo .I take 250px const

4条回答
  •  抹茶落季
    2021-02-19 04:17

    Here is an example for applying other elements width to current element.

    Width of the element which has the class name "container" will apply to div using flexibleCss angular js directive

    myApp.directive('flexibleWidth', function(){ return function(scope, element, attr) { var className = attr.widthof; var classWidth = angular.element(document.querySelectorAll('.'+className)[0])[0].clientWidth; element.css({ width: classWidth+ 'px' }); }; });

提交回复
热议问题