ng-form support
Any chance you could support ng-form directive instead of requriing the form tag?
+1
I've done some code changes to support it on my installation:
-
add '?^ng-form' to the 'require' option in editableDirectiveFactory: require: [overwrites.directiveName, '?^form', '?^ng-form'],
-
reverse the order of how the directive finds out whether a form exists or not: if e-form is specified, it takes precedence over a parent form/ng-form. Once e-form is found, we lookup either a form or ng-form with the same name in the doc:
// element explicitly references e-form - take precedence: if(attrs.eForm) { // element not wrapped by <form>, but we hane `e-form` attr var getter = $parse(attrs.eForm)(scope); if(getter) { // form exists in scope (above), e.g. editable column eFormCtrl = getter; hasForm = true; } else { // form exists below or not exist at all: check document.forms for(var i=0; i<$document[0].forms.length;i++){ if($document[0].forms[i].name === attrs.eForm) { // form is below and not processed yet eFormCtrl = null; hasForm = true; break; } } var ngforms = $('ng-form[name="' + attrs.eForm + '"]'); if (ngforms.length > 0) { eFormCtrl = null; hasForm = true; } } } else if(ctrl[1] || ctrl[2]) { // element does not explicitly reference e-form but already wrapped by form eFormCtrl = ctrl[1] || ctrl[2]; hasForm = true; }
see if this helps... note I'm using Jquery here... guess I can use angular's liteJQ instead and iterate ng-forms manually instead of using a selector..
@sagimann Can you post how you were using the ng-form? I'm trying to use the code above but I don't think I using the editable with ng-form correctly. I'm not able to submit the form.