Also -- here is an example with a date picker that sort of shows the same thing --- http://plnkr.co/edit/xq4R1gh0lvQSFafpnHuQ -- the model value will not be converted to the "proper" format until it is changed once in the view.
On Monday, June 1, 2015 at 9:44:43 AM UTC-4, Paul Selden wrote: > > Thanks Sanders -- so for your suggestion to convert the data in the > controller before it gets to the ngModel pipeline -- I'm having trouble > implementing that in my simple example without changing the semantics of > the control. > > Let's say I add an isolate scope to grab the ngModel and manipulate it in > the controller as in this updated plunk: > http://plnkr.co/edit/jnE3s8MRr1tFCX0WVYel?p=preview > > Now instead of having the input text be "SOME UPPERCASE TEXT" and the > model (correctly) be "some uppercase text" -- both are lowercase because > the work is happening before NgModelController kicks in. > > Could you please show me what you meant by your suggestion if this was not > what you had in mind? > > The only way I can figure out how to get it to work how I want it right > now is doing this -- but that seems wrong to me because I'm "crossing > pipelines" -- so to speak. > > ngModel.$formatters.push(function(value) { > ngModel.$setViewValue(value); > ngModel.$render(); > ngModel.$setPristine(); > > return value; > }); > > > Thanks again Sander, > Paul > > > > > On Saturday, May 30, 2015 at 12:15:28 AM UTC-4, Sander Elias wrote: >> >> Hi Paul, >> >> 1. yes, >> 2. no, >> 3. No and Yes. >> >> I always like binary questions :) >> In your situation I would go second half of point 3 tough! Convert the >> data in the controller/service before exposing it in the view. >> >> Regards >> Sander >> >> >> >> -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
