0.0.8 • Published 9 years ago

angular-ts-utils v0.0.8

Weekly downloads
3
License
ISC
Repository
github
Last release
9 years ago

ts-utils

A package of open-sourceable angularjs utils

Installation

  1. bower install townsquared/utils
  2. load the utils.js
  3. 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);