-
Notifications
You must be signed in to change notification settings - Fork 176
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
Not working with ng-include #276
Comments
Do you mind post your script code here? |
this is my app.js config for validator app.config([ '$validationProvider', function($validationProvider) {
$validationProvider.showSuccessMessage = false;
$validationProvider.setValidMethod('submit');
} ]) this is my ng-include, i'm setting the ng-include from my controller <html ng-app="adminapp" ng-controller="MainCtrl">
<div ng-include="masterscreen" ></div>
</html> and this is the form i'm loading from my controller to the ng-include <div ng-controller="AddForm">
<form name="AddForm">
<p class="arguments ">
<h4 class="popup-headingtabs">ADD LOG</h4>
<table class="popup-arguments ">
<tr>
<td style="width: 200px;">Service Type<font color="red">
*</font></td>
<td><input type="text" class="fieldwidth-text-long"
name="serviceType" ng-model="Add.serviceTyp"
validator="required" /></td>
</tr>
<tr>
<td colspan="4" align="center">
<button validation-submit="AddForm" ng-click="savemodal()"
class="btn btn-default">Save</button>
</td>
</tr>
</table>
</form>
</div> |
Do you mind setup a fiddle/jsbin/others example so that I can look quickly? |
Same issue: Here is my code:
This is shell html page
This is template html page -> tab
Nothing happens with this code. No validation is fired on 'blur' and also it passes through form.validate() |
This is how I pull in sub-forms I define a new directive for the form inputs - usually in it own folder so I can just require the folder and just get index.js to bind it all together
Then I create the directive which references the template and controller
and create a simple controller to inject the validation
And then its a matter of just defining the mark-up that goes inside - with your normal components / inputs
This can then be called from the apps page and pulled into any page mark-up - by just adding a simple call to the the directive inside a form
Whilst I know that I'm not using <ng-include> to pull in the template - it does allow me to pull in templates forms and have them validate without issue. I use this approach across many applications and it works just as you would expect validation to work |
Hey,
my form to be validated is within an ng-include directive, and my validation is on submit, but when i click the submit button, I'm getting this error in
This is not a regular Form name scope
Provider.validate @ angular-validation.js:183
(anonymous) @ angular-validation.js:367
dispatch @ jquery.js:3
r.handle @ jquery.js:3
angular-validation.js:368 Uncaught TypeError: $validationProvider.validate(...).success is not a function
at HTMLButtonElement. (angular-validation.js:368)
at HTMLButtonElement.dispatch (jquery.js:3)
at HTMLButtonElement.r.handle (jquery.js:3)
The text was updated successfully, but these errors were encountered: