Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make angular-xeditable edit state always enabled

I am using angular-xeditable to edit elements within a form. I would like to have all the elements in "editable" mode at all times, e.g. no "edit" button needs to be pushed before the user starts editing.

I have been trying to use the $show() in my controller to enable the elements in the form, however it seems like the elements goes into viewing state again for example when using "onaftersave" when trying to save the values etc.

How do I do in order to always be in edit mode where the user never needs to enable editing in order to start editing the values?

like image 349
rikard Avatar asked Sep 23 '14 06:09

rikard


2 Answers

Possibly try adding shown=true in your html:

<form editable-form shown="true">
like image 135
bruce.donovan Avatar answered Nov 15 '22 22:11

bruce.donovan


I had this same problem. Even when trying to $show() the form again at the end of my onaftersave function it still wouldn't work. I suspect the visibility is being hidden after the onaftersave function runs but I didn't actually check if that's the case. Here's how I got around it:

$scope.$watch('yourFormName.$visible', function() {
    $scope.yourFormName.$show();
});

Now whenever the form visibility changes to hidden, it will just show it again regardless of when it changed.

like image 40
tcox Avatar answered Nov 15 '22 23:11

tcox