ts-utils
A package of open-sourceable angularjs utils
Installation
bower install townsquared/utils
- load the
utils.js
angular.module('myApp', ['ts.utils'])
Utils
focusOn
Focuses an input on scope broadcasted event.
Specify the name of the broadcast event you would like to use to trigger the focusing.
<input focus-on="someEventName">
or
<input focus-on="focus-row-{{$index}}">
$scope.$broadcast('someEventName');
or
$scope.$broadcast('focus-row-'+$index);
scrollOn
Scroll to a certain point inside an overflowing DOM element on scope broadcasted event.
Specify the name of the broadcast event you would like to use to trigger scrolling.
Pass the location to scroll to as the data of the event.
Location: 'top' | 'bottom' | 200
<ul scroll-on="someEventName" style="overflow: auto">...</ul>
var location = 'bottom';
$scope.$broadcast('someEventName', location);