katemihalikova / ion-datetime-picker

Date and/or time picker for awesome Ionic framework
MIT License
169 stars 101 forks source link

only-valid attribute is Not taking value From Any Variable #56

Closed anjaligithub closed 7 years ago

anjaligithub commented 7 years ago

As I am trying to select date from particular Interval of days , It is working with hard coded value to only-valid attribute And not with the value in variable. My code is as follows

woking==>

<div class="col" ion-datetime-picker date  ng-model="date" placeholder="dd/mm/yyyy" only-valid="{'between': {'initial': '2016-7-01', 'final': '2016-10-30' }, 'inclusive': true}" ng-change="setTime()"></div>

Not working==>

<div class="col" ion-datetime-picker date  ng-model="date" placeholder="dd/mm/yyyy" only-valid="{'between': {'initial': '{{date1}}', 'final': 'date2' }, 'inclusive': true}" ng-change="setTime()"></div>
katemihalikova commented 7 years ago

Hi Anjali, it seems you missed how angular works. only-valid attribute gets an angular expression so you need to put your variables there directly, just like you would in common javascript.

<div ion-datetime-picker date ng-model="date" only-valid="{'between': {'initial': date1, 'final': date2}, 'inclusive': true}"></div>