Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation for nested object #23

Closed
zeeshanhanif opened this issue Aug 28, 2014 · 12 comments
Closed

Validation for nested object #23

zeeshanhanif opened this issue Aug 28, 2014 · 12 comments

Comments

@zeeshanhanif
Copy link

I wonder why validation is not applied on this nested object's name property:

$scope.user = {
myData: {
name:""
}
};

@nelsonomuto
Copy link
Owner

I need more context, may you please expand on your circumstance.

@zeeshanhanif
Copy link
Author

There is a nested object "myData" inside the user object which is directly tied to a $scope, Now I need to assign the name property through textbox with validation, so I simply used this code:

But it does not simply validate it, When I remove myData from ng-model i.e assign "name" property directly to the user, Validation works fine, Am I missing something?

@nelsonomuto
Copy link
Owner

Ok thanks, I'm working on this, I will update you asap

@nelsonomuto
Copy link
Owner

The problem was that the css selector to display the error message was not escaping a '.' character which was present due to nesting as the implementation assigns the model property as one of the error message element class names.

@nelsonomuto
Copy link
Owner

I ran into an interesting problem while solving this bug, read about it here and see if you have any thoughts to contribute: escaping special characters in jquery selector using a variable vs literal string

@zeeshanhanif
Copy link
Author

Have this issue completely been fixed?, Validation now works but the error span is still not showing up.

@nelsonomuto
Copy link
Owner

yes the issue is fixed. I will send you a short plunker in a few minutes demonstrating a working scenario.

@nelsonomuto
Copy link
Owner

also i forgot to update the dist folder, so that may be why you are experiencing the same error, I will do this as well now

@zeeshanhanif
Copy link
Author

Oh, So many thanks

@nelsonomuto
Copy link
Owner

No problem, everything should work now and here is the plunker demonstrating a nested username property: http://plnkr.co/edit/9msvUd?p=preview

@nelsonomuto
Copy link
Owner

i'm experiencing some issues updating the npm package. it is now on version 1.1.10 for latest.

to get latest:
npm install [email protected]

@nelsonomuto
Copy link
Owner

it looks like its working now, as long as the version you get from npm is greater than 1.1.5 you are good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants