KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am creating a custom directive in Angular JS. And I want to format the ng-model before the template renders. This is what I have so far: app.js app.directive('editInPlace', function() { return { require: 'ngModel', restrict: 'E', scope: { ngModel: '=' }, template: '<input type="text" ng-model="ngModel" my-date-picker disabled>' }; }); html <edit-in-place ng-model="unformattedDate"></edit-in-place> I want to format the unformattedDate value before it is entered in the ngModel of the template. Something like this: template: '<input type="text" ng-model="formatDate(ngModel)" my-date-picker disabled>' but that gives me an error. How to do this?
Tags (comma-separated)
Save Edits
Cancel