这有效:
DetailEvent 是一个对象,其start_time类型为 Date
<span class="month">{{DetailEvent.start_time | date: 'MMM'}}</span>
这不起作用:
<div class="col-md-6"><input type="text" [(ngModel)]='DetailEvent.start_time| date: 'MMM''> <span class="calender-to">to</span> </div>
管道通常不适用于"双向绑定">
[(ngModel)]='fromDate | date: 'MMM''
应该是
[ngModel]="fromDate | date: 'MMM'" (ngModelChange)="fromDate = $event"