bonjour,
je souhaiterai récupérer la largeur d'un bloc (alimenter par un ng-repeat pour l'utiliser dans d'autres fonctions) et le nombre de sous-éléments.
merce de votre aide.
voici le code :


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
//HTML
<ul class="slide-footer-list">
      <li class="slide-footer-item" slidefooteritem>
        <a href="{{slide.link}}" class="slide-footer-img-link" ng-repeat="slide in slides">
          <img class="slide-footer-img" src="{{'app/img/slide/'+slide.image}}"/>
        </a>
      </li>
      <li class="slide-footer-borders"></li>
</ul>

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
//CONTROLLER
...
.controller( 'FooterRestController', [ '$scope', 'FooterRestService', 'FooterSlideService', function( $scope, FooterRestService, FooterSlideService) {
  		var footer = FooterRestService.query( function() {
		    $scope.slides	 			= footer[0].slide;
		    $scope.footersCol1 			= footer[0].column1.items;
		    $scope.footerTitleCol1		= footer[0].column1.title;
		    $scope.footerSubTitleCol1 	= footer[0].column1.subtitle;
		    //DOM : FOOTER SLIDE
			$( FooterSlideService.animateFooterSlide());
		});
}]);

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
//SERVICE
...
.factory( 'FooterSlideService', [ function() {
		return {
			animateFooterSlide: function( scope, elm, attrs) {
				scope.li			= $parse( attrs.slidefooteritem)(scope);
                                var itemsNum		= $('.slide-footer-img-link').length;
				console.log( '++++++++++++++++++++ '+scope.li.width()+' +++++++++++++++++++++');
				console.log( '++++++++++++++++++++ '+itemsNum+' +++++++++++++++++++++');
			}
		};
}])
...