Open piotr-dobrogost opened 7 years ago
Can you add some more specific on what you are trying to achieve?
In my case some fields should only be editable when adding new entries and not when editing existing ones. That is why upon entering edit mode I hide edit fields which are not meant to be used when editing (as opposed to adding) entry. I guess better approach on my side would be to use something like ng-show
and conditionally show edit fields based on weather user is editing already existing entry or adding a new one. Though I'm not sure how to go about accessing mode (add/edit) in ng-show
attribute of edit fields?
Yes, one way to do that is do the ng-if
based upon the unique key of the row. If no id exists, don't show fields, if id exists, show fields.
Ok, in this case I'm going to change approach. Still I guess there should be easy way to access edit fields by name in more advanced scenarios. Closing for now. I guess if more people want this then this issue could be reopened later.
If you decide to investigate you original issue some more and find a solution, please create a pull request.
Would like to revisit this. Does angular-xeditable create underneath standard AngularJS input component (one from those listed at https://docs.angularjs.org/api/ng/input) and if so then how to access it from (or pass into) onbeforesave()
function? Such a component has for example $valid
and $error
properties.
Are you trying to use angular's built in validations? If so, this project is not setup to use them. There are several issues that haven been opened for this, here is #76 .
It looks like you linked this issue by mistake.
Fixed it
I was looking for a method to access specific editable fields of a form by name but it seems there's no such a method. Basically the implementation would be very similar to
$activate
(https://github.com/vitalets/angular-xeditable/blob/0.8.0/src/js/editable-form/controller.js#L173-L182).