katemihalikova / ion-datetime-picker

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

Change bindings from = to @ #12

Open adyba opened 8 years ago

adyba commented 8 years ago

For some reasons I'm having some difficulties to get text values inside the directive scope. Once I have changed the binding method from bidirectional "=" to one-way text binding "@" it works as expected.

katemihalikova commented 8 years ago

Can you please provide your failing code?

adyba commented 8 years ago

I believe

 scope: {
   modelDate: "=ngModel",
   title: "=",
   subTitle: "=",
   buttonOk: "=",
   buttonCancel: "="
   },

should be

scope: {
   modelDate: "=ngModel",
   title: "@",
   subTitle: "@",
   buttonOk: "@",
   buttonCancel: "@"
   },
adyba commented 8 years ago

sorry for the mess ;)

katemihalikova commented 8 years ago

Thanks for your suggestion. Using @ instead of = should help with performance optimization so I'm going to add this to a backlog and implement it in the future.


But the current version works as expected. There seems to be an oversight on your side: = attribute requires an expression, not an interpolated string. You should use string expression or scope variable:

<ion-item ion-datetime-picker ng-model="datetimeValue" title="'This is a string'"></ion-item>
<ion-item ion-datetime-picker ng-model="datetimeValue" title="titleTranslation"></ion-item>