I'm trying to fire an event when user finish typing into input field and I'm stuck at reading the value which was entered :(
Here is my code:
js
var subtitlesApp = angular.module('subtitlesApp', ['ngResource', 'ngCookies']);
subtitlesApp.directive('ngModelOnblur', function ($timeout) {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, elm, attr) {
elm.unbind('input').unbind('keydown').unbind('change');
elm.bind('blur', function() {
scope.$apply(function(imdb_id) {
console.log(imdb_id)
})
});
}
};
})
html
<input id="subtitle-imdb_id" type="text" ng-model="subtitle.imdb_id" ng-model-onblur/>
I'm getting:
a {$id: "004", this: a, $$listeners: Object, $parent: e, $$asyncQueue: Array[0]…}
Instead of getting the value of elm or imdb_id.
Thanks.