简体   繁体   English

Angular xeditable禁用表单

[英]Angular xeditable disable the form

I am using the angular directive: http://vitalets.github.io/angular-xeditable/ 我正在使用angular指令: http : //vitalets.github.io/angular-xeditable/

And I am trying to get the form displayed as a disabled form, I mean, with all the element disabled (disabled html attribute). 我试图将表单显示为禁用的表单,我的意思是,所有元素都被禁用(禁用的html属性)。

I saw that there is a flag of the form, $waiting set by $setWaiting() , that behaves like that, but there aren't a way to invoke this status as the $show() . 我看到有如下形式的标志, $waiting通过设置$setWaiting()其行为像,但目前还没有一种方法来调用此状态为$show()

There is a way to access to that method from my controller? 有一种方法可以从我的控制器访问该方法? or in the other hand, how i can extend the directive to make this method public. 或者,另一方面,我如何扩展指令以将此方法公开。

Thanks! 谢谢!

I know this is a late answer, but as no one has answered this... 我知道这是一个较晚的答案,但是因为没有人回答这个问题...

I think to mess with the $waiting attribute could get you in more trouble that help, as it handles the state of submitting and who know what else. 我认为弄乱$waiting属性可能会给您带来更多麻烦,因为它可以处理提交状态以及其他人知道什么。

The easiest way to accomplish disabling the form-elements is to just use the e-ng-disabled attribute of each editable-control bound to a $scope variable like this: 完成禁用表单元素的最简单方法是仅使用绑定到$scope变量的每个editable-control的e-ng-disabled属性,如下所示:

<span editable-text="my_model" e-name="name" 
    e-ng-disabled="form_disabled">{{ my_model }}</span>

Here is a fiddle: http://jsfiddle.net/jf2ykddv/5/ 这是一个小提琴: http : //jsfiddle.net/jf2ykddv/5/

Just for the record, of course it would be nice to be able to disable all controls with some kind of "global" attribute directly through the form, but I don't think thats implemented in angular-xeditable. 仅作记录,当然可以直接通过表单禁用具有某种“全局”属性的所有控件,这很好,但我认为那不是在angular-xeditable中实现的。 So this is probably the easiest way. 因此,这可能是最简单的方法。

仅在标签中添加属性。

e-ng-disabled="[value]"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM