Form not sending out select and checkbox inputs in Angular 2 -


i'm working on small angular 2 to-do app. didn't want have problems browser compatibility inputs types date, datetime-local, etc., did make <select> inputs user type in date , time. works fine, inputs dynamic, user cannot choose day not exist (like e.g. 02/29/2017), etc.

the problem is, want send form's data service , back-end of app, when submit form, values <select> inputs not included in sent object, checkbox input. i'm not using these types of inputs, i'm sorry if noobish question, cannot figure out i'm doing wrong.

here code:

<form #f="ngform" (ngsubmit)="add(f.value)">      <div *ngif="error">         <p>{{ error }}</p>     </div>     <div class="login-input-container">         <input type="text" placeholder="title" name="title" ngmodel autocomplete="off" required minlength="1" maxlength="100">     </div>      <div class="login-input-container">         <div class="datetime-container">             <div>                 <select #year name="year" (change)="showmonths(); selectedyear = year.value; yeardays(year.value);" required>                     <option class="invisible" value="" disabled selected>year</option>                     <option *ngfor="let year of years" [value]="year" placeholder="year">{{ year }}</option>                 </select>                 <select #month *ngif="showedmonths" name="month" (change)="showdays(month.value, year.value); selectedmonth = month.value;" required>                     <option class="invisible" value="" disabled selected>m</option>                     <option *ngfor="let month of months" [value]="month">{{ month }}</option>                 </select>                 <select *ngif="showeddays" name="day" (change)="showtime()" required>                     <option class="invisible" value="" disabled selected>d</option>                     <option *ngfor="let day of days" [value]="day">{{ day }}</option>                 </select>             </div>             <div *ngif="showedtime">                 <select name="hours" required>                     <option class="invisible" value="" disabled selected>hh</option>                     <option *ngfor="let hour of hours" [value]="hour">{{ hour }}</option>                 </select>                 :                 <select name="minutes" required>                     <option class="invisible" value="" disabled selected>mm</option>                     <option *ngfor="let minute of minutes" [value]="minute">{{ minute }}</option>                 </select>             </div>         </div>     </div>      <div class="login-input-container">         <textarea id="todo-description" type="text" placeholder="description (optional)" name="description" ngmodel autocomplete="off" minlength="1" maxlength="500"></textarea>     </div>      <div class="login-input-container">         <span><p>should notify you?</p><label for="notify-1"><input id="notify-1" type="checkbox" [checked]="todo.notify" value="1"><span></span></label></span>     </div>      <div class="login-input-container">         <input type="submit" value="submit" (click)="error = ''">     </div>   </form> 

if use [value] or [ngvalue] need use [(ngmodel)] or ngmodel (ngmodelchange)="showmonths()..." instead of `(change)="..."


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -