I have a code like http://codepen.io/sidfz/pen/iICHg
.
The problem is how to know in my controller if the form is valid or not.
Also, I had some issues when, sometimes, it was just giving out that the form wasn’t valid.
I have a code like http://codepen.io/sidfz/pen/iICHg
.
The problem is how to know in my controller if the form is valid or not.
Also, I had some issues when, sometimes, it was just giving out that the form wasn’t valid.
Can anyone help me on this?
This used to be possible in Ionic. However, something changed along the way and I could never get it to work again. Even using $parent.faleComigoForm
rarely works anymore. Sometimes, you can access the form with $parent.$parent
, however this is just a mess.
Now, I use directives to manage my forms. That way, the directive is as close to the form as possible.
I’ve modified your example : http://codepen.io/calendee/pen/bxiIj?editors=101
I’m not sure this is the BEST way, but it works for me. Anyone else have suggestions?
Dude, thanks fr the suggestion. But it doesn’t work for me.
I need to know if the form is valid to allow/block user to submit it.
But the button shouldn’t be disabled at any time.
I wasn’t disabling the buttons at all. They were just below the fold.
Here is a version that validates before allowing a final submission : http://codepen.io/calendee/pen/jkubi?editors=101
Oh, now I got it… the example previous was working too… I just didn’t noticed that $scope was the same that the controller!