Skip to content

Instantly share code, notes, and snippets.

@nl5887
Last active December 30, 2015 09:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nl5887/7811152 to your computer and use it in GitHub Desktop.
Save nl5887/7811152 to your computer and use it in GitHub Desktop.
app.directive 'ngInitial', ->
restrict: 'A'
controller: ['$scope', '$element', '$attrs', '$parse', ($scope, $element, $attrs, $parse) ->
val = $attrs.sbInitial || $element.val()
getter = $parse($attrs.ngModel)
setter = getter.assign
setter($scope, val)
]
@nl5887
Copy link
Author

nl5887 commented Dec 5, 2013

Updated to work with input, textarea and selects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment