Reputation: 4599
I have written custom price format directive using angularjs.
It will trigger an event while 'blur' event happened. But, how do i call the function while opening(by default) the page.. I need to call directive function while opening the page.
<input name="amt" type="text" class="form-control text-right" name="amt" id="amt" data-ng-model="rowUnderEdit.amount" format-currency required>
.directive('formatCurrency', function() {
return {
require: 'ngModel',
link: function($scope, $element, $attrs, ngModelCtrl) {
var listener = function(){
console.log('>>>>>>>>');
---------------
--------------
$element.val(currency);
}
}
$element.bind('blur', listener);
}
}
});
Upvotes: 0
Views: 57
Reputation: 11308
Simply call the function...
....
$element.bind('blur', listener);
listener();
}
Upvotes: 1