HI simon radice . along with your code . i just added few things which 
might leverage the directive . jScrollPane with addition of dynamic 
content. and resize on window heights
app.directive('niceScroll', [function () {
  return {
    restrict: 'A',
    transclude: true,
    template: '<div class="nice-scroll" ng-transclude></div>',
    link: function (scope, element, attb) {
      element.jScrollPane();
      var api = element.data('jsp');
      var w = $(window);
     // it will  re-initalize 
      element.bind('mouseover', function () {
        $('.jspContainer').height(w.height());
        api.reinitialise();
      });
      scope.$watch(function () {
        return {
          h: w.height()
        }
      }, function (newValue) {
        $('.jspContainer').height(newValue.h);
        api.reinitialise();
      }, true);

      w.bind('resize', function () { 
        scope.$apply();
      });
    }
  };
}]);
On Friday, February 15, 2013 at 10:28:57 PM UTC+5:30, simone radice wrote:
>
> i create a directive for scrollpane and with scope.$watch observe when the 
> number of repeated element change. Every time the repeated element change 
> i reinitialise jScrollPane.
>
> appModule.directive('scrollpane',function($compile)
> {
> return {
> restrict: 'A',
> link: function(scope , element , attrs) {
> element.addClass('scroll-pane');
> element.jScrollPane();
> var api = element.data('jsp');
> scope.$watch(function(){return 
> element.find('.'+attrs.scrollpane).length},function(length){
>      api.reinitialise();
> });
>     }
>   };
> });
>
> Il giorno venerdì 6 luglio 2012 18:15:42 UTC+2, lost_in_the_woods ha 
> scritto:
>>
>> Hi,
>>
>> I'm trying to use http://jscrollpane.kelvinluck.com/ with ng-repeat. 
>> It's a div scroller. However, I need to initialize it after the size of the 
>> div.contents() is known -- i.e., after ng-repeat is done inserting elements.
>>
>> Is there an event that ng-repeat emits/broadcasts after it finishes DOM 
>> manipulation?
>>
>> THanks.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to