Reputation: 2164
I have made a div and I want to get its width in its directive. How can I do it?
Here is the div:
<div scatter-chart id="divVisScatter-{{item}}" class="divVis divVisScatter col-sm-6">
</div>
And the corresponding directive:
myApp.directive('scatterChart', function($window){
return{
restrict:'EA',
template:"<svg width='850' height='200'></svg>",
link: function(scope, elem, attrs){
var d3 = $window.d3;
var rawSvg=elem.find('svg');
var svg = d3.select(rawSvg[0]);
//want to get the width of div here
}
};
});
Upvotes: 1
Views: 142