AngularJS: Empty - latest CI build
by carpasse
HTML
<script src="http://ci.angularjs.org/job/angular.js-angular-master/ws/build/angular.js"></script>
<input type="text" ng-model="value" ng-model-onblur>
{{value}}
JavaScript
function Main() {}
// override the default input to update on blur
angular.module('app', []).directive('ngModelOnblur', function() {
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, elm, attr, ngModelCtrl) {
if (attr.type === 'radio' || attr.type === 'checkbox') return;
elm.unbind('input').unbind('keydown').unbind('change');
elm.bind('blur', function() {
scope.$apply(function() {
ngModelCtrl.$setViewValue(elm.val());
});
});
}
};
});