How to set field2 equal to field1 when set?

26 views
Skip to first unread message

Jonathan Matthew Beck

unread,
Jun 17, 2014, 9:52:44 AM6/17/14
to ang...@googlegroups.com
We have 2 datepicker fields.  Is there an Angular way to set the second one equal to the first as soon as the User sets the first?  Then once they've both been set, break this binding?

                                        <h6 class="lighter smaller blue form-label-lri">
                                            From Date:
                                        </h6>
                                        <input date-picker-directive class="input-small-lri" filter-field="field"
                                               type="text" date-field-numb="1"
                                               data-ng-model="field.selectedDate1"/>
                                        <h6 class="lighter smaller blue form-label-lri">
                                            To Date:
                                        </h6>
                                        <input date-picker-directive class="input-small-lri" filter-field="field"
                                               type="text" date-field-numb="2"
                                               data-ng-model="field.selectedDate2"/>

Istvan Bekesi

unread,
Jun 17, 2014, 11:48:21 AM6/17/14
to ang...@googlegroups.com

You can use $pristine of FormController to identify user interaction in field2.
More info: https://docs.angularjs.org/api/ng/type/form.FormController

Take a look at my plunk to see how it works:
http://plnkr.co/edit/xitWoXPyKpw34uXq0U4w?p=preview


roberto sacchetti

unread,
Jun 17, 2014, 11:56:31 AM6/17/14
to ang...@googlegroups.com
thanks for reply but they are not the author of the question;


--
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 angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--


Roberto Sacchetti _ [Web Developer]
m. +39 339 66 20 430 _

Roberto Sacchetti - programmatore web / php / ruby / python
P.iva 02508430598
C/F sccrrt83a16e472x
sito: www.robertosacchetti.com

mail: in...@robertosacchetti.com

mail: sacchett...@gmail.com
skype: roberto_sacchetti

Istvan Bekesi

unread,
Jun 17, 2014, 12:48:13 PM6/17/14
to ang...@googlegroups.com
Sorry I don't get it, maybe you posted in wrong thread?

Jonathan Matthew Beck

unread,
Jun 17, 2014, 7:59:33 PM6/17/14
to ang...@googlegroups.com
Thanks Istvan, that makes pristine sense. :) 


--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/5SMCH0dP0J8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages