0
私はカレンダーのドロップダウンを持って、それは働いています。しかし、私はそれにデフォルトの日付を提供したい。どのようにそれを行うことができます。次のように私の構成要素である後どのようにprimengの日付のデフォルト値を提供する
次のように
import {HttpClient} from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { routerTransition } from '../../router.animations';
import { isNumber } from '@ng-bootstrap/ng-bootstrap/util/util';
@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss'],
animations: [routerTransition()]
})
export class DashboardComponent implements OnInit {
value= new Date();
today_date: string;
ngOnInit() {
this.today_date = this.value.getFullYear() + '-' + this.value.getMonth() + '-' + this.value.getDate();
console.log(this.today_date)
}
}
HTMLコードは次のとおりです。
<div>
<p-calendar (ngModel)="today_date" [inputStyle]="{'width':'100%'}" dateFormat="yy-mm-dd"></p-calendar>
</div>
それは、日付アップピッキングされていません。 Console.log outは '2017/10/17'