A custom scrollbar written in pure AngularJS
npm install ng-scrollbarWorks with the mouse and on touch screen.
Tired of using jquery for a stupid scrollbar? well, this directive is just for you.
1. Add ng-scrollbar.min.js to you main file (index.html)
you can download this by:
* using bower and running bower install ng-scrollbar
* Download the [production version][min] or the [development version][max].
[min]: https://raw.github.com/asafdav/ng-scrollbar/master/dist/angular-ng-scrollbar.min.js
[max]: https://raw.github.com/asafdav/ng-scrollbar/master/dist/angular-ng-scrollbar.js
In your web page:
``html`
2. Set ngScrollbar as a dependency in your module`
javascript`
var myapp = angular.module('myapp', ['ngScrollbar'])
3. Add ng-scrollbar directive to the wanted element, example:
`html`
....
html
....
`
`javascript
// rebuild the scrollbar
$scope.$broadcast('rebuild:me');
`In case you need to rebuild the scrollbar on every window's resize, you may use "rebuild-on-resize" option.
`html
....
`In case you need to stick content to bottom (chat or something) use "bottom" option.
`html
....
`Events and Flags
On rebuilding the scrollbar you can get notified by 2 events
`javascript
$scope.$on('scrollbar.show', function(){
console.log('Scrollbar show');
});
$scope.$on('scrollbar.hide', function(){
console.log('Scrollbar hide');
});
`Or you can use "is-bar-shown" option. It should be read-only
`html
....
Bar shown: {{flag}}
``
