Discovering all the day's events using angular-bootstrap-calendar

Can the angular-bootstrap-calendar provide an option to access the day's information using

on-timespan-click = "dateClicked(eventsOfTheDay)"

angular.module('myApp', ['mwl.calendar', 'ui.bootstrap'])
  .controller('calendarCtrl', ['$scope',
    function($scope) {
      $scope.calendarView = 'month';
      $scope.calendarDate = new Date();
      $scope.bookings = [{
        title: 'Today',
        type: 'info',
        startsAt: new Date(2016, 2, 10, 1),
        endsAt: new Date(2016, 2, 10, 2),
        recursOn: 'month',

        editable: false,
        deletable: false,
        draggable: false,
        resizable: false,
        incrementsBadgeTotal: true,
        cssClass: 'a-css-class-name'
      }, {
        title: 'Today is saturday',
        type: 'info',
        startsAt: new Date(2016, 2, 10, 3),
        endsAt: new Date(2016, 2, 10, 4),
        editable: false,
        deletable: false,
        draggable: true,
        resizable: true,
        incrementsBadgeTotal: true,
        recursOn: 'month',
        cssClass: 'a-css-class-name'
      }, {
        title: 'Today is saturday',
        type: 'info',
        startsAt: new Date(2016, 2, 10, 3),
        endsAt: new Date(2016, 2, 10, 4),
        editable: false,
        deletable: false,
        draggable: true,
        resizable: true,
        incrementsBadgeTotal: true,
        recursOn: 'month',
        cssClass: 'a-css-class-name'
      }, {
        title: 'Today is saturday',
        type: 'info',
        startsAt: new Date(2016, 2, 11, 3),
        endsAt: new Date(2016, 2, 11, 4),
        editable: false,
        deletable: false,
        draggable: true,
        resizable: true,
        incrementsBadgeTotal: true,
        recursOn: 'month',
        cssClass: 'a-css-class-name'
      }];

      $scope.bookingClicked = function(theBooking) {
        console.clear();
        console.log("This is your booking you clicked");
        console.log(theBooking);
      };

      $scope.dateClicked = function(todaysBooking) {
        console.clear();
        console.log("hello mate");
        console.log(todaysBooking);
        alert(todaysBooking);
      };
    }
  ]);
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/interact.js/1.2.4/interact.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap-tpls.min.js"></script>
<script src="//mattlewis92.github.io/angular-bootstrap-calendar/dist/js/angular-bootstrap-calendar-tpls.min.js"></script>
<script src="example.js"></script>
<script src="helpers.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="//mattlewis92.github.io/angular-bootstrap-calendar/dist/css/angular-bootstrap-calendar.min.css" rel="stylesheet">
<body ng-app="myApp" ng-controller="calendarCtrl" class="container">
  <div class="row">
    <div class="col-sm-12">
      <h1 class="text-center"><{{calendarTitle}}</h1>
      <mwl-calendar view="calendarView" view-date="calendarDate" events="bookings" on-event-click="bookingClicked(calendarEvent)" view-title="calendarTitle" on-timespan-click="dateClicked(eventsOfTheDay)" on-event-times-changed="calendarEvent.startsAt = calendarNewEventStart; calendarEvent.endsAt = calendarNewEventEnd"
      edit-event-html="'<i class='glyphicon glyphicon-pencil'></i>'" delete-event-html="'<i class='glyphicon glyphicon-remove'></i>'" on-edit-event-click="eventEdited(calendarEvent)" on-delete-event-click="eventDeleted(calendarEvent)" cell-is-open="true">
      </mwl-calendar>
    </div>
  </div>

Answer №1

With the

on-timespan-click="dateClicked(calendarCell.events)"
feature, you can easily refer to this source.

angular.module('myApp', ['mwl.calendar', 'ui.bootstrap'])
  .controller('calendarCtrl', ['$scope',
    function($scope) {
      $scope.calendarView = 'month';
      $scope.calendarDate = new Date();
      $scope.bookings = [{
        title: 'Today',
        type: 'info',
        startsAt: new Date(2016, 2, 10, 1),
        endsAt: new Date(2016, 2, 10, 2),
        recursOn: 'month',

        editable: false,
        deletable: false,
        draggable: false,
        resizable: false,
        incrementsBadgeTotal: true,
        cssClass: 'a-css-class-name'
      }, {
        title: 'Today is Saturday',
        type: 'info',
        startsAt: new Date(2016, 2, 10, 3),
        endsAt: new Date(2016, 2, 10, 4),
        editable: false,
        deletable: false,
        draggable: true,
        resizable: true,
        incrementsBadgeTotal: true,
        recursOn: 'month',
        cssClass: 'a-css-class-name'
      }, {
        title: 'Today is Sunday',
        type: 'info',
        startsAt: new Date(2016, 2, 11, 3),
        endsAt: new Date(2016, 2, 11, 4),
        editable: false,
        deletable: false,
        draggable: true,
        resizable: true,
        incrementsBadgeTotal: true,
        recursOn: 'month',
        cssClass: 'a-css-class-name'
      }];

      $scope.bookingClicked = function(theBooking) {
        console.clear();
        console.log("Here is the booking you clicked");
        console.log(theBooking);
      };

      $scope.dateClicked = function(todaysBooking) {
        console.clear();
        console.log("Hello there!");
        console.log(todaysBooking);
        alert(todaysBooking.length);
      };
    }
  ]);
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/interact.js/1.2.4/interact.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap-tpls.min.js"></script>
<script src="//mattlewis92.github.io/angular-bootstrap-calendar/dist/js/angular-bootstrap-calendar-tpls.min.js"></script>
<script src="example.js"></script>
<script src="helpers.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="//mattlewis92.github.io/angular-bootstrap-calendar/dist/css/angular-bootstrap-calendar.min.css" rel="stylesheet">
<body ng-app="myApp" ng-controller="calendarCtrl" class="container">
  <div class="row">
    <div class="col-sm-12">
      <h1 class="text-center">{{calendarTitle}}</h1>
      <mwl-calendar view="calendarView" view-date="calendarDate" events="bookings" on-event-click="bookingClicked(calendarEvent)" view-title="calendarTitle" on-timespan-click="dateClicked(calendarCell.events)" on-event-times-changed="calendarEvent.startsAt = calendarNewEventStart; calendarEvent.endsAt = calendarNewEventEnd"
      edit-event-html="'<i class=\'glyphicon glyphicon-pencil\'></i>'" delete-event-html="'<i class=\'glyphicon glyphicon-remove\'></i>'" on-edit-event-click="eventEdited(calendarEvent)" on-delete-event-click="eventDeleted(calendarEvent)" cell-is-open="true">
      </mwl-calendar>
    </div>
  </div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for organizing my data upon its return into a more efficient structure

I need to restructure API data that is not optimized in its current format Unfortunately, I am unable to ask backend developers to make the necessary changes, so I am exploring ways to clean up the model locally before using it in my Angular 2 application ...

Transfer data from HTML button to Javascript function

I'm having trouble passing a value from a button in my HTML document to a JavaScript function in another document. I've tried using getElementById(), but it's not working. What could be the issue? Any help would be greatly appreciated. Thank ...

Looking to customize session data for my online game within the same interface

I have successfully coded a game called Ninja Gold using PHP with CodeIgniter. The game works by setting session variables (Gold and Activities) when the index page loads if they are not set already. Each location clicked adds a certain amount of gold to t ...

Removing items from arrays with a specific attribute in react js

In ReactJS, I am dealing with an array that contains data for the regions GB (UK) and US (USA): { "id": 603692, "results": [ { "iso_3166_1": "GB", "release_dates": [ { ...

Adding up the values within a range of numbers in an array using a callback function

Can you help me spot the issue in this code snippet? function range(start, end){ var arrayRange = []; for(i= start; i<=end; i++){ arrayRange.push(i) } return(arrayRange); } var r = range(1,10); console.log(r); function sumRange(sumArray){ ...

time interval between closing angularjs modal and redirection

I'm currently utilizing an AngularJS modal, however, when I need to redirect to another view, I find myself having to close it and add a delay to hide the shadow before transitioning to the new page. Is there a faster solution available? I'm usi ...

Place the Javascript pop-up in the center of the screen

Hey there! I was able to create a popup on my screen but it's currently positioned in the center of the page instead of the screen itself. Is there a way for me to make sure it appears in the center of the screen and not just the page? I'm usin ...

Extract data from a JSON object sent from an Angular frontend and process it in a C# ASP.Net

Having trouble creating a new Salesman with Angular and C#. I am collecting user input data in an array (newData) from my Angular controller and sending it to my C# server-side controller through a service. However, I am encountering errors and unable to r ...

I'm having trouble pinpointing the cause of the never-ending loop in this React code that is using Material UI grid

There seems to be an issue with infinite looping in this code, and I can't figure out the cause, import React, { useEffect, useState } from 'react'; import VideoCardComponent from './VideoCard'; import Grid from '@mui/material ...

PLSQL and HTML combine in Oracle Apex to create dynamic regions

Using Oracle Apex 4.2 with Oracle 12c For example: In my PL/SQL region in Apex, I have the following code to create a drop-down list: <button id="Clickme" onclick="myFunction()">Click me</button> <br> <select name="F01" class="my ...

Struggling to make the AJAX script function properly

I have a table containing a list of transactions and I am attempting to update the table contents at specific intervals. The web page is hosted on a Linux Red Hat server, and currently, only the AJAX functionality is not functioning as expected. <!do ...

Troubleshooting problems with scrolling on JavaScript in Edge, Opera, and Chrome

Currently, I am developing a fun CSGO-inspired box opening feature on my food recipe website that randomly selects recipes for users. However, I have encountered some challenges with the scrolling functionality. It seems to be incompatible with certain bro ...

Angular Digest Loop for Dynamic Photo Grid Styling

I have a special filter that alters the objects being filtered. However, when I apply ng-style="item.gridSize", it triggers my custom grid algorithm. This algorithm was adapted for my requirements from a source found at this link. angular.module("custom.m ...

Utilizing Express to load a uniform static website across all website paths

On my express server, I attempted to make all paths load the same static website using this code: const express = require('express'); const app = express(); app.use('*', express.static('build')); app.listen(3000); But every ...

Responsive frame structure

I have set up a scene using A-frame () where I currently have a green box attached to the camera at all times. However, as the camera moves, the box also moves along with it. My question is, how can I position the box in the top right corner of the screen ...

Manually validate inputs in Angular

I've encountered an issue with the bootstrap datepicker. When I click on the date icon, the date and time automatically populate in the input field. However, the input remains invalid because I haven't directly interacted with it. Has anyone else ...

Smooth polygons in a Three.js model

After implementing the following code: var manager = new THREE.LoadingManager(); manager.onProgress = function ( item, loaded, total ) { console.log( item, loaded, total ); }; var texture = new THREE.Texture(); var loader = new THREE.ImageLoader( ...

Storing AngularJS Data on Server

Recently delving into AngularJS and starting to find my way around it, I must say I'm quite enjoying the experience. Transitioning from the Java/JSP realm has definitely posed a learning curve for me! Currently, my focus is on configuring logging to ...

Implementing a redirect and setting a background image dynamically in ASP.NET using code-behind

I have a section in my PHP template with a onclick event handler. My goal is to redirect users to another page when they click on this section. Here's what I've attempted: HTML: <section id="header" onclick="window.location.href='Anoth ...

Utilize Angular 5 to implement URL routing by clicking a button, while also preserving the querystring parameters within the URL

I have a link that looks like this http://localhost:4200/cr/hearings?UserID=61644&AppID=15&AppGroupID=118&SelectedCaseID=13585783&SelectedRoleID=0 The router module is set up to display content based on the above URL structure { path: & ...