简体   繁体   中英

Angular Datapicker don't pass value through NgModel

i have a page with a form that works as a filter search and one of fields is a date field.

I configured the angular ui date ( https://github.com/angular-ui/ui-date ) and the calendar works when i focus the date field.

The problem is:

When i try submit the form, the date field value don't pass to controller through of ng-model, but the other fields works. If i remove ui-date from input, works too.

What i'm doing wrong?

MY HTML

<form novalidate name="filterForm" ng-submit="submitFiltro()">
<label class="painel-datas-text" for="field-5">Product</label>
<input class="painel-data-select w-input" id="field-5" maxlength="256" ng-model="filtro.produto" name="produto" placeholder="NET / CLARO" required="required" type="text">

<label class="painel-datas-text" for="field">Date</label>
<input ui-date class="painel-data-select w-input" id="field" maxlength="256" ng-model="filtro.de" name="date" placeholder="01/02/2016" required="required" type="text">

<label class="painel-datas-text" for="field-2">seller</label>
<input class="painel-data-select w-input" id="field-2" maxlength="256" ng-model="filtro.vendedor" name="vendedor" placeholder="TODOS" required="required" type="text">

<input class="painel-button w-button" type="submit" value="FILTRAR">

MY JS:

var app = angular.module('painelvendas', ['ui.date']);
app.controller('painelController', function($scope, $http) {
    $scope.submitFiltro = function(){
        console.log($scope.filtro);
    };
});

根据我在文档中看到的内容,不应在要使用指令的地方设置输入的类型。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM