iominh / ng-scrollbars

Angular wrapper of Malihu's jQuery Custom Scrollbar
http://iominh.github.io/ng-scrollbars/
MIT License
202 stars 62 forks source link

Rebuild scrollbar on config change #25

Closed adalekin closed 8 years ago

iominh commented 8 years ago

Hi @adalekin! Thank you for the PR. Could you describe your changes a bit more and perhaps your use case with why you made the change?

It looks like other than formatting (which looks nicer!) it looks like the following was changed:

-        ngScrollbarsConfig: '&',
 +        ngScrollbarsConfig: '=?',

Did you make this change so that ng-scrollbars directives only optionally require a scrollbarsConfig attribute? I think this sounds like a good change but the scrollbars should then revert to sensible defaults, which would need to be tested.

Thanks again! Minh

adalekin commented 8 years ago

Hi @iominh! Thank you for your reply.

Please see:

+        scope.$watch('ngScrollbarsConfig', function (newVal, oldVal) {

In my current project I need to disable mouseWheel on some pages. That is why I need to rebuild scrollbar.

I've got a global scrollbar with inner ui-view (from ui-router):

div(ui-view, ng-scrollbars, ng-scrollbars-config="$root.scrollbarConfig"}")

The page controller is able to change this config via $rootScope.scrollbarConfig.

iominh commented 8 years ago

Thanks for the PR! I've merged it and did a follow-up commit to address the scenario when no ngScrollbarsConfig is defined, as seen in the Angular Material demo (http://iominh.github.io/ng-scrollbars/10.html).

Assuming this otherwise isn't broken, I'll probably be rolling out a 0.0.9 release in the near future with your changes