Skip to content

Instantly share code, notes, and snippets.

@Ulv
Created May 28, 2014 08:19
Show Gist options
  • Select an option

  • Save Ulv/6a5d92a614442d16976d to your computer and use it in GitHub Desktop.

Select an option

Save Ulv/6a5d92a614442d16976d to your computer and use it in GitHub Desktop.
angularjs, coffeescript: app ng-update-hidden directive (use hidden form field with angular model)
# Usage: <input type="hidden" ng-model="elementid" ng-update-hidden />
.directive 'ngUpdateHidden', ->
(scope, el, attr) ->
model = attr["ngModel"]
scope.$watch model, (nv) ->
el.val nv
return
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment