I want to know the width of the & lt; div & gt; in my model of guidelines, and store in the variable how can I achieve this

advertisements

to know the width of div

i want to know the width of the within the template ,and store in the variable how can i achieve that

pp.directive('skillSlider',function()
        {
    return{
        template:'<div class="progress"></div>'
        }
        });

----------
how to calculate the width of the div inside the directive template

You can do this with angular.element e.g.:

angular.element(document.getElementById(id)).clientWidth;
angular.element(document.querySelectorAll('.class')[0]).clientWidth;

or if you have jQuery loaded

angular.element($('#id').width();
angular.element($('.class')[0]).width();