bind status value from component to html in angular-calendar

霸气de小男生 提交于 2021-02-11 15:09:24

问题


I'am using angular-calendar with a custom template as given here : https://mattlewis92.github.io/angular-calendar/#/custom-templates,

I have array of date and status of task on that date in my component

arr = [
    { 3: "success" },

    { 1: "Rejected" },

    { 18: "success" },

    { 10: "Pending" },

    { 9: "success" },

    { 8: "Rejected" },

  ]

in html file i have dropdown in cell of calender month view

What i want to do is if status on date given in arr is "success" then in calendar on that date dropdown selected value is success and same with Rejected and Pending

HTML:

<ng-template #customCellTemplate let-day="day" let-locale="locale">
  <div class="cal-cell-top">
    <span class="cal-day-badge" *ngIf="day.badgeTotal > 0">{{ day.badgeTotal }}</span>
    <span class="cal-day-number">
      {{ day.date | calendarDate:'monthViewDayNumber':locale }}
      <select name="" id="dropdown" style="margin: 5px;color: cadetblue;width: 130px;">
        <option value="{{status}}" (click)="dropdownmethod2($event.target.value,day.date)" *ngFor="let status of status">{{status}}</option>
      </select>
    </span>
  </div>
  <!-- <small style="margin: 5px;" >There are {{ day.events.length }} events on this day</small> -->

</ng-template>

<div [ngSwitch]="view">
  <mwl-calendar-month-view [viewDate]="viewDate" [events]="events" (eventClicked)="handleEvent('Clicked', $event.event)"
    [cellTemplate]="customCellTemplate">
  </mwl-calendar-month-view>

TS:

  status= ['success',"pending","Rejected"]
  arr = [
    { 3: "success" },

    { 1: "Rejected" },

    { 18: "success" },

    { 10: "Pending" },

    { 9: "success" },

    { 8: "Rejected" },

  ]

来源:https://stackoverflow.com/questions/64675233/bind-status-value-from-component-to-html-in-angular-calendar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!