1

I'm using a angular xeditable text control. I want to open it in edit mode automatically. How can I do it?

My question is similar to this one however, I am not using editable-form (not using a form element at all). The only solutions I find are using the editable-form's $show() function, but you do not have it if you do not have an editable-form.

While at it, I also would like to use the functionality provided by editable-form's $setError() function, without using an editable-form and not through the onbeforesave or onaftersave attributes (I want to do it upon opening the xeditable text control, not when user submits). Is it possible ?

I do not want to use an editable-form because I have just this one xeditable input, and the use of a form changes things like submit, blur, buttons displayed, etc. in ways that I do not want.

6
  • Can you show the code? Commented Jul 28, 2016 at 15:07
  • Sure: <div class="xedit ng-scope"><span e-name="titleCtrl" editable-text="book.title" e-label="Title" onbeforesave="checkTitle($data)"> {{ book.title || 'title' }} </span></div> So the question is how to open that xeditable text input programmatically (e.g. using ng-init) without the user having to click on it first. The input is not inside an editable-form, so I cannot use $show(). Commented Jul 29, 2016 at 9:33
  • I just want to confirm if this is the behaviour you want. look at this plunker Commented Jul 29, 2016 at 15:19
  • That looks good indeed. So the trick is simply to put an <input> element in the HTML, which xeditable turns into an <a> element on submit ? How does it decide to make it an <a> element and not (for example) a <span> element, can you control that ? Commented Aug 1, 2016 at 7:55
  • In my example I don't use the xeditable. It is raw angularjs. you can use <span> or other desired element you want! if you need explaination I will add comment for you to understand! Commented Aug 1, 2016 at 8:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.