javascript - Can't submit form when add scope to directive AngularJS -
when remove scope everyting works fine...
here directive:
function addcomment(commentfactory) { //creating button comment , call link function var addcomment = { link: link, restrict: "e", scope: { valid: '=' }, template: '<input type="submit" ng-disabled="valid" class="btn btn-default pull-right" value="send" />' }; ....
here html:
<form name="maincomment" ng-submit='addcomment(param)' class="dd animated slideindown" novalidate> <div class="form-group"> <text-angular name="maintxt" required ta-max-text="600" ta-min-text="15" ng-model="form.comment"></text-angular> <span style="color:red" ng-show="maincomment.maintxt.$dirty && maincomment.maintxt.$invalid"> <span ng-show="maincomment.maintxt.$error.required">thread content required.</span> </span> <p style="color:red" ng-show="maincomment.maintxt.$error.tamaxtext">text should @ last 15 characters.</p> <p style="color:red" ng-show="maincomment.maintxt.$error.tamintext">text should not more 15 characters.</p> </div> <!--directive submit button , client content append--> <addcomment valid="maincomment.maintxt.$invalid"></addcomment> </form>
Comments
Post a Comment