Sha256: 5356ebb976a7a6aad5d18ae1d868cf6510c165351d1302b94b7ce7c0ab2f3e90
Contents?: true
Size: 764 Bytes
Versions: 1
Compression:
Stored size: 764 Bytes
Contents
angular.module('EssayApp.directives').directive "limitInput", [() -> restrict: 'A' scope: true require: "ngModel" link: (scope, element, attr, ngModel) -> reg = undefined fn = -> attr.limitInput scope.$watch fn, (reg_s)-> if reg_s reg = new RegExp(attr.limitInput) else reg = undefined fromUser = (text) -> if text? && reg? res = reg.exec(text) if res?.length > 0 transformedInput = res[res.length-1] else transformedInput = "" if transformedInput isnt text ngModel.$setViewValue transformedInput ngModel.$render() return transformedInput else return undefined ngModel.$parsers.push(fromUser) ]
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
translation_cms-0.1.5 | app/assets/javascripts/app/directives/limit_input.js.coffee |