ziscloud / angular-slimscroll

angular directive for jquery slimscroll
MIT License
63 stars 31 forks source link

Does not work #14

Open gmarshall56 opened 9 years ago

gmarshall56 commented 9 years ago

I'm getting this error: TypeError: undefined is not a function at refresh (http://localhost:9000/assets/javascripts/app/directives.js:249:30) at init (http://localhost:9000/assets/javascripts/app/directives.js:254:21) at link (http://localhost:9000/assets/javascripts/app/directives.js:278:17) at nodeLinkFn (http://localhost:9000/assets/javascripts/lib/angular/angular-1.2.27.js:6736:13) at compositeLinkFn (http://localhost:9000/assets/javascripts/lib/angular/angular-1.2.27.js:6130:13) at compositeLinkFn (http://localhost:9000/assets/javascripts/lib/angular/angular-1.2.27.js:6133:13) at compositeLinkFn (http://localhost:9000/assets/javascripts/lib/angular/angular-1.2.27.js:6133:13) at compositeLinkFn (http://localhost:9000/assets/javascripts/lib/angular/angular-1.2.27.js:6133:13) at nodeLinkFn (http://localhost:9000/assets/javascripts/lib/angular/angular-1.2.27.js:6730:24) at compositeLinkFn (http://localhost:9000/assets/javascripts/lib/angular/angular-1.2.27.js:6130:13)

and lines 249 thru 278 of your directive are these lines: line 249=> $($elem).slimScroll({ destroy: true }); $($elem).slimScroll(option); }; var init = function () { line 254=> refresh(); if ($attr.slimscroll && !option.noWatch) { off.push($scope.$watchCollection($attr.slimscroll, refresh)); } if ($attr.slimscrollWatch) { off.push($scope.$watchCollection($attr.slimscrollWatch, refresh)); } if ($attr.slimscrolllistento) { off.push($scope.$on($attr.slimscrolllistento, refresh)); } }; var destructor = function () { $($elem).slimScroll({ destroy: true }); off.forEach(function (unbind) { unbind(); }); off = null; }; off.push($scope.$on('$destroy', destructor)); line 278= > init(); Is this the correct HTML syntax to call the directive:

{{ someTextHere || 'nuttin here' }}

If not can you please provide a sample syntax of calling the directive? Thank you Gary
ziscloud commented 9 years ago

You can use this directive: <div class="scroll-body" slimscroll="{height: 150}">

gmarshall56 commented 9 years ago
gmarshall56 commented 9 years ago

Got it working. Two things: First: stupid mistake on my part. Needed to download and include the jquery.slimscroll.min.js file from github.com/rochal/jQuery-slimScroll. Second: The correct syntax to use is: div class="scroll-body" slimscroll="{height: '250px'}" (single quotes required around the value).

fresjitendra commented 8 years ago

i want to give my custom style for slim scroll i have used div class="scroll-body" slimscroll="{height: '250px'}" but it is not working it is using its default height