vitalets / angular-xeditable

Edit in place for AngularJS
http://vitalets.github.io/angular-xeditable
MIT License
1.91k stars 403 forks source link

Two way data binding on e-attribute #701

Open logan-jobzmall opened 6 years ago

logan-jobzmall commented 6 years ago

Hello,

When using an e-attribute (directive), I have a two way data binded value:

<span editable-text="vm.store.color" e-background-color="{{vm.color}}" e-ng-change="vm.changeColor($data)" e-colorpicker="hex" e-colorpicker-with-input="true" e-name="founded">{{ vm.store.color }}</span>

The vm.changeColor() will set vm.color to whatever has changed on the colorpicker. I have a background-color directive I made that will set the background color to the color of any color you bind to it. Specifically, {{vm.color}} doesn't seem to update the underlying input at runtime. Is there a way to two-way data bind to the child input when using e-attributes?

Thanks!

ckosloski commented 6 years ago

I think the issue here is that you are using vm.color which isn't updated until you submit. If you are trying to change the color while the editable is open, try using $data instead.

logan-jobzmall commented 6 years ago

$data does get not populated unfortunately. I believe I saw another ticket around that...

ckosloski commented 6 years ago

Can you provide a plunkr or jsfiddle?