ion-datetime-picker icon indicating copy to clipboard operation
ion-datetime-picker copied to clipboard

Change bindings from = to @

Open adyba opened this issue 8 years ago • 4 comments

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.

adyba avatar Mar 02 '16 21:03 adyba

Can you please provide your failing code?

katemihalikova avatar Mar 03 '16 07:03 katemihalikova

I believe

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

should be

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

adyba avatar Mar 07 '16 00:03 adyba

sorry for the mess ;)

adyba avatar Mar 07 '16 00:03 adyba

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>

katemihalikova avatar Mar 08 '16 09:03 katemihalikova