title: how to set date value in frontend with ngoninit in angular 5
body: <p>i have an <code>&lt;input type="date"&gt;</code> which i want to be filled when the user enters the route. By visiting the site the input field should already be the actual date.
  So i think <code>ngOnInit()</code> should be what i need. But what do i have to do to have the actual date filled in as a value to the input field, when the user enters the route?</p>
  
  <p>I already tried to achive this by searching the web but only found some old solutions for angularjs although i'm using angular 5 which is not compareable with angularjs. The postings i found all pointed to the scope which is no longer existent.</p>
  
  <p>The Documentation for <code>ngOnInit</code> also does not help me :/</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label&gt;Eingangsdatum&lt;/label&gt;
      &lt;input type="date" [(ngModel)]="dateArrival" id="dateArrivalPicker" value="" name="dateArrival" class="form-control"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Compontent</strong></p>
  
  <pre><code>@Component({
    selector: 'app-terminals-create',
    templateUrl: './terminals-create.component.html',
    styleUrls: ['./terminals-create.component.css']
  })
  export class TerminalsCreateComponent implements OnInit {
  
    type: String;
    serial: String;
    layout: String;
    dateArrival: Date;
    activated: Boolean;
    setup: String;
    firmware: String;
    installedAt: String;
    createdBy: String;
    createdDate: Date;
    lastModified: Date;
    lastModifiedBy: String;
    notes: String;
    macAddress: String;
  
  
    constructor(
      private validateService: ValidateService,
      private flashMessage: FlashMessagesService,
      private authService: AuthService,
      private router: Router
    ) { }
  
    ngOnInit() {}
  
  }
  </code></pre>
  
  <hr>
  
  <p>If i do like briosheje wrote in his comments it works, his answer doesn't :/. And there is one more thing... by using his comment i get two big errors inside my console:</p>
  
  <pre><code>Error: If ngModel is used within a form tag, either the name attribute must be set or the form
        control must be defined as 'standalone' in ngModelOptions.
  
        Example 1: &lt;input [(ngModel)]="person.firstName" name="first"&gt;
        Example 2: &lt;input [(ngModel)]="person.firstName" [ngModelOptions]="{standalone: true}"&gt;
  </code></pre>
  
  <p>If i now give a name to my <code>&lt;input type="date" [ngModel]="todaysDate | date:'dd-MM-yyyy'" (ngModelChange)="todaysDate = $event" [value]="todaysDate | date:'yyyy-MM-dd'"&gt;</code>
  the function of filling this field with the acutal date is gone and only TT.MM.YYYY stands there. What can i do?</p>