Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 1, 2020. It is now read-only.
This repository was archived by the owner on Jul 1, 2020. It is now read-only.

Error when inserting input with validation from controller #82

@ShlomoRosenheimer

Description

@ShlomoRosenheimer

We insert a html via controller into our view (I know it's bad...) like so:

// rule in rules...
<td translate="{{rule.id}}" translate-values="rule.parameterInputs"  translate-compile></td>
// ctrl, for each rule...
// in rule.parameterInputs, we store the input...

          '<input class="form-control form-control-inline"' +
          'ng-model="' + modelName + '"' +
          'name="parameterInput' + parameter.id + '"' +
          'validation="required"' +
          '>'

Html output, at runtime

<input class="form-control form-control-inline ng-pristine ng-untouched ng-valid ng-scope" ng-model="rules[0].parameters[1].value" name="parameterInput1" validation="required">

Produces the error for each input:

TypeError: Cannot read property 'getAttribute' of null
    at x (http://localhost:6040/bower_components/angular-validation-ghiscoding/dist/angular-validation.min.js:10:6696)
    at y (http://localhost:6040/bower_components/angular-validation-ghiscoding/dist/angular-validation.min.js:10:5543)
    at new _ (http://localhost:6040/bower_components/angular-validation-ghiscoding/dist/angular-validation.min.js:10:13491)
    at link (http://localhost:6040/bower_components/angular-validation-ghiscoding/dist/angular-validation.min.js:9:3072)
    at invokeLinkFn (http://localhost:6040/bower_components/angular/angular.js:8652:9)
    at nodeLinkFn (http://localhost:6040/bower_components/angular/angular.js:8152:11)
    at compositeLinkFn (http://localhost:6040/bower_components/angular/angular.js:7543:13)
    at publicLinkFn (http://localhost:6040/bower_components/angular/angular.js:7418:30)
    at compile.A (http://localhost:6040/bower_components/angular-translate/angular-translate.min.js:6:17275)
    at http://localhost:6040/bower_components/angular-translate/angular-translate.min.js:6:16950 <input class="form-control form-control-inline ng-pristine ng-untouched ng-valid ng-scope" ng-model="rules[47].parameters[0].value" name="parameterInput78" validation="required">

Another question: is it possible disable the input field based error messages below an input field? I only want to use the summary above the form, not the feedback for each input field. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions