Sha256: f2ecd4fda09c4b15888a6d8461779346aec6a69a124df2cbfb8fcbca80dbd19d
Contents?: true
Size: 689 Bytes
Versions: 1
Compression:
Stored size: 689 Bytes
Contents
angular.module('EssayApp.directives').directive 'ngBindLazy', ['$timeout', ($timeout) -> restrict: 'A' scope: false link: (scope, element, attrs) -> # replace value only when it's available # and return initial value on undefined/errors origin = element.html() fn = if attrs.lazyFactor? -> if scope.$eval(attrs.lazyFactor) scope.$eval(attrs.ngBindLazy) else undefined else -> try scope.$eval(attrs.ngBindLazy) catch e undefined scope.$watch fn, (res)-> if res?.length > 0 element.html(res) else element.html(origin) ]
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
translation_cms-0.1.5 | app/assets/javascripts/app/directives/ng-bind-lazy.js.coffee |