0
我有一个视图叫做129.html,它的格式如下所示。它基本上是从json文件中读取的一堆问题。将控制器的功能添加到某个视图中在角度
<div class="" ng-repeat="group in groups">
<h2 ng-bind="group.title"></h2>
<div class="" ng-repeat="section in group.sections">
<div class="" ng-repeat="field in section.fields">
<!-- textfield -->
<div class="form-group" ng-class="{ 'has-error': form.$submitted && form[field.id].$invalid }" ng-if="field.type === 'text'">
<!-- <label for="{{field.id}}">{{field.title.substr(field.title.indexOf('.') + 2)}}</label><br> -->
<label for="{{field.id}}">{{field.title}}</label>
<br>
<input type="text" class="form-control" id="{{field.id}}" name="{{field.id}}" ng-model="formData[field.id]" ng-required="field.validations.required" ng-minlength="field.validations.min_length">
<p class="form-group-note" ng-if="field.info" ng-bind="field.info"></p>
<div ng-show="form.$submitted" ng-cloack>
<span class="help-block" ng-show="form['{{field.id}}'].$error.required" ng-if="field.validations.required">Please enter a value, this field is required</span>
<span class="help-block" ng-show="form['{{field.id}}'].$error.minlength" ng-if="field.validations.min_length">Please enter a value of at least {{field.validations.min_length}} characters</span>
</div>
</div>
</div>
</div>
安娜我有MainController.js
它具有节省用户输入的localStorage实时的功能。但是,好像我的129.html
不能识别maincontroller。我可以如何将它添加到视图中?我见过类似ng-controller=MainController
的东西,但我不确定这是否正确。
请提供更多详情,但没有足够的信息帮助你。 – Viraj