I am trying to get an element's width in my ionic app. But I get an undefined with this code:
html:
$scope.suggestProWidth = angular.element(document.querySelectorAll("suggestPro")[0]).clientWidth;
console.log("$scope.suggestProWidth", $scope.suggestProWidth);
controllers.js:
<ion-slide ng-repeat="s in [0,1,2,3,4,5,6]">
<ul>
<li ng-repeat="item in prodata | matchingProBrand:computed.proName:computed.proBrand | limitTo:s*sliderItemNumber+sliderItemNumber | limitTo:-sliderItemNumber">
<a class="suggestPro" ng-click="launchComputeService(item.id)">
<span><img ng-src={{imagesUrls[item.imageName]}} /></span>
<p class="flex-caption"> {{item.model}} - {{item.name}}</p>
</a>
</li>
</ul>
</ion-slide>
Can you help me figure this out ?
Thanks
suggestPro?querySelectorandquerySelectorAlltakes.classor#idortagNameor any css selector.$scope.suggestProWidth = angular.element(document.querySelectorAll(".suggestPro")[0]).clientWidth; console.log("$scope.suggestProWidth", $scope.suggestProWidth);doesn't work either...