Angularjs does not find the input

Asked

Viewed 26 times

-1

I’m trying to make a form where a field I want has a maximum of 10 characters, but the angle seems to be ignoring the field, for testing I had demonstrate on the screen the value of "$Valid": follows command below:

<form name="formNewTask" class="form-signin" method="post" th:action="@{/saveTask}">
<div class="form-group">
    <label for="problem" class="sr-only">Problema</label>
    <div class="cols-sm-10">
        <div class="input-group">                            
            <input ng-maxlength="10"  th:value="${task.problem}" type="text" class="form-control" id="problem" name="problem" placeholder="Problema" required="required"/>                              
        </div>
    </div>
</div>  

<div class="alert alert-danger">{{formNewTask.problem.$valid}}</div>
</form>

Below is a picture of how the result of "{formNewTask.problem. $Valid}}"

inserir a descrição da imagem aqui

Note 1: No error in the browser console. Obs 2: this screen already has another functionality with the angular, so this imported correctly.

1 answer

0

I found, must be created a model so he can read the field:

<input ng-model="tasksJS.problem" ng-maxlength="10" ng-required="true"  th:value="${task.problem}" type="text" class="form-control" id="problem" name="problem" placeholder="Problema" required="required"/>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.