Skip to content

Instantly share code, notes, and snippets.

@mahizsas
Created September 12, 2013 12:25
Show Gist options
  • Save mahizsas/6536523 to your computer and use it in GitHub Desktop.
Save mahizsas/6536523 to your computer and use it in GitHub Desktop.
.directive('ngInitial', ['$parse', function ($parse) {
return {
require: 'ngModel',
restrict: 'A',
link: function link(scope, element, attr, model) {
var val = attr.ngInitial || attr.value || element.text();
$parse(attr.ngModel).assign(scope, val);
}
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment