(Solved) : Typescript Add Column Using Loop Creating Calendar Using Angular Want Add Gym Counts Table Q42675391 . . .

Typescript, how to add up a column using a for loop. I amcreating a calendar using angular and I want to add the gym countson the table column that I created but I am stuck. This is what Ihave so far. The gym count that I created doesnt work . It isbold.

@Component({

  selector: ‘app-events’,

  templateUrl: ‘./events.component.html’,

  styleUrls: [‘./events.component.css’]

})

export class EventsComponent implements OnInit {

  @ViewChild(‘modalContent’, { static: true })modalContent: TemplateRef<any>;

  modalData: {

    action: string;

    event: CalendarEvent;

  };

  actions: CalendarEventAction[] = [

    {

      label: ‘<i class=”fafa-fw fa-pencil”></i>’,

      onClick: ({ event }: {event: CalendarEvent }): void => {

        this.handleEvent(‘Edited’,event);

      }

    },

    {

      label: ‘<i class=”fafa-fw fa-times”></i>’,

      onClick: ({ event }: {event: CalendarEvent }): void => {

        this.events =this.events.filter(iEvent => iEvent !== event);

        this.handleEvent(‘Deleted’,event);

      }

    }

  ];

  events: CalendarEvent[] = [

    {

      start:subDays(startOfDay(new Date()), 1),

      end: addDays(new Date(),1),

      title: ‘A 3 day event’,

      color: colors.red,

      actions: this.actions,

      allDay: true,

      resizable: {

        beforeStart:true,

        afterEnd:true

      },

      draggable: true

    },

    {

      start: startOfDay(newDate()),

      title: ‘An event with no enddate’,

      color: colors.yellow,

      actions: this.actions,

    },

    {

      start:subDays(endOfMonth(new Date()), 3),

      end: addDays(endOfMonth(newDate()), 3),

      title: ‘A long event thatspans 2 months’,

      color: colors.blue,

      allDay: true

    },

    {

      start:addHours(startOfDay(new Date()), 2),

      end: new Date(),

      title: ‘A draggable andresizable event’,

      color: colors.yellow,

      actions: this.actions,

      resizable: {

        beforeStart:true,

        afterEnd:true

      },

      draggable: true

    },

  ];

  gym = {gymCount: null};

  constructor(private modal: NgbModal) {}

  ngOnInit() {

  }

  deleteEvent(eventToDelete: CalendarEvent) {

    this.events = this.events.filter(event=> event !== eventToDelete);

  }

  handleEvent(action: string, event: CalendarEvent):void {

    this.modalData = { event, action };

    this.modal.open(this.modalContent, {size: ‘lg’ });

  }

  addEvent(): void {

    this.events = [

      …this.events,

      {

        title: ‘Newevent’,

        start:startOfDay(new Date()),

        end:endOfDay(new Date()),

        color:colors.red,

        draggable:true,

        resizable: {

          beforeStart:true,

          afterEnd:true

        }

      }

    ];

  }

  gymCount() {

    let gymTime = 0;

    for (let i = 0; i <this.gymCount.length; i++) {

gymTime += this.gymCount[i].gymCount;

console.log(‘gymTime —->’, gymTime);

    }

    return {

      total:gymTime

    };

  }

}

Expert Answer


Answer to Typescript, how to add up a column using a for loop. I am creating a calendar using angular and I want to add the gym c…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?