Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs验证在表单上无法正常工作_Angularjs_Validation_Angularjs Directive - Fatal编程技术网

Angularjs验证在表单上无法正常工作

Angularjs验证在表单上无法正常工作,angularjs,validation,angularjs-directive,Angularjs,Validation,Angularjs Directive,我有以下表格: <form name="commentForm" class="form-horizontal" role="form" novalidate> <div class="form-group"> <label class="control-label col-sm-2" >Enter Name:</label> <div class="col-sm-10" show-errors>

我有以下表格:

<form name="commentForm" class="form-horizontal" role="form" novalidate>
    <div class="form-group">
        <label class="control-label col-sm-2" >Enter Name:</label>
        <div class="col-sm-10" show-errors>
            <input type="text" class="form-control" id="name" name="name" ng-model="subject.name" placeholder="Enter Name" required>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2"  for="comment">Enter comment:</label>
        <div class="col-sm-10" show-errors>
            <textarea class="form-control" rows="5" id="comment" name="comment" ng-model="subject.text" style="resize: none;" required></textarea>
        </div>
    </div>
    <div class="form-group"> 
        <div class="col-sm-offset-2 col-sm-10">
            <button ng-click="submitForm()" type="submit" class="btn btn-default" ng-disabled="commentForm.$invalid">Submit</button>
        </div>
    </div>
</form>

输入名称:
输入注释:
提交
我已经创建了一个RORS指令来显示必填字段的错误


但此表单验证无法正常工作。尽管如果我在其他部分中使用相同的代码,它仍然可以正常工作。我在这里可能会犯什么错误?

您的
显示错误指令在做什么。你能发布你的
显示错误
指令吗?我检查了我的控制器,发现submitForm中有一个错误导致了这个问题。你的
显示错误
指令在做什么。你能发布你的
show errors
指令吗?我检查了我的控制器,发现submitForm中有一个错误导致了这个问题。