ngModel question

Hi, I have a quite simple app where ppl can add Tasks. is the following

<ion-content padding>
        <ion-label position="stacked">Task Title</ion-label>
        <ion-input type="text" ([ngModel])="task_title"></ion-input>
        <ion-label position="stacked">Task Description</ion-label>
        <ion-input type="text" ([ngModel])="task_description"></ion-input>
        <ion-label position="stacked">Task last date</ion-label>
        <ion-datetime min="2019" display-format="DD/MM/YYYY" ([ngModel])="task_last_date"></ion-datetime>
  <ion-button expand="block" shape="round" color="danger" (click)="addTask()">Add Task</ion-button>
</ion-content> is the follwing

import { Component, OnInit } from '@angular/core';
import * as firebase from 'firebase';
import { ToastController, NavController } from '@ionic/angular';

  selector: 'app-add-task',
  templateUrl: './',
  styleUrls: ['./'],
export class AddTaskPage implements OnInit {

  task_title: string;
  task_description: string;
  task_last_date: Date;
  task_owner: string;

  constructor(private toastCtrl: ToastController, private navCtrl: NavController) {
    this.task_owner = firebase.auth().currentUser.uid;


  ngOnInit() {

  addTask() {


When I click the button to add the task, in the console log I see 3 undefineds and only this.task_owner variable is populated.

Am I missing something stupid?


Shouldn’t it be [(ngModel)]?

1 Like

Wow I’m mad now… And I did it right on the login page… Thanks for the help, probably need some sleep before going on!