i want to hide some part of the input text value using some filter.
app.directive('limtToDate', ['$filter', function ($filter) {
var dateFormat = "DD/MM/YYYY HH:mm"
return {
restrict: 'A',
link: function (scope, ielem, attrs) {
scope.$watch(attrs.ngModel, function (v) {
console.log('value changed, new value is: ' + v);
$filter('limitTo')(ielem.val(), -5);
});
}
}}]);
http://jsfiddle.net/PqAhk/2/
well, my input text should just show 12:12 instead of 01/01/1970 12:12. and after editing the time, for example, if user change the time to 12:40 my ng-model has to be like following 1970/01/01 12:40
First, thank you all, this solution was created by @guru and many thanks to him.
http://plnkr.co/edit/VhsleIWMq8A4rJcVQDaw?p=preview
the solution takes advantage from $formatter and $parser related to the angularjs pipeline rendering.
https://docs.angularjs.org/api/ng/type/ngModel.NgModelController
ps : this solution is not compatible with angularjs.2-rc.x
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With