steps for integrating firebase data with angular fullCalendar

I am currently attempting to connect FireBase data with my fullCalendar plugin in an angular application. Unfortunately, it seems that the plugin is not compatible with data.$asObject() or data.$as Array().

Here is what I have implemented so far, but it is not displaying any meetings:

Controller:

(function () {
    var app = angular.module("myCal");
    app.controller('meetingsCtrl', meetingsCtrl);

    function meetingsCtrl($scope, $http, $location, $firebase) {

        var ref = new Firebase(firebaseurl); // actual URL
        var meetings = $firebase(ref);

        $scope.fireEvents = meetings.$asObject(); // Unable to get $asArray() working as well

    } // controller func

})();

Directive:

(function () {
    var app = angular.module("myCal");

    app.directive("sbCalendar", function () {
        return {
            link: function (scope, element, attrs) {
                $(element).fullCalendar({

                    header: {
                        left: 'prev,next today',
                        center: 'title',
                        right: 'month,agendaWeek,agendaDay'
                    },
                    eventLimit: true, // show "more" link for multiple events
                    aspectRatio: 4,
                    events: scope.fireEvents,
                    editable: true,
                    eventDrop: function (event, delta, revertFunc) {

                    } // event drop

                }); // initializing fullCalendar & options

            } // link

        } // return 
    }); // directive
})();

This is the JSON file uploaded to Firebase (the Firebase URL points to "meetings"):

{
    "meetings": {
        "x1": {
            "title": "test subject",
            "start": "2016-10-20",
            "end": "2016-10-20",
            "description": "some long description test"
        },
        "x2": {
            "title": "test2 subject",
            "start": "2016-11-05",
            "end": "2016-11-06",
            "description": "another long description for test 2"
        },
        "x3": {
            "title": "test3 new subject",
            "start": "2016-11-11",
            "end": "2016-11-11",
            "description": "yet another description for test 3"
        }
    }
}

Answer №1

(function () {
    var app = angular.module("myCal");
    app.controller('meetingsCtrl', meetingsCtrl);

    function meetingsCtrl($scope, $http, $location, $firebaseArray) {
        var ref = new Firebase(firebaseurl); // actual URL
        $scope.fireEvents = $firebaseArray(ref);
    }

})();

This code showcases the latest syntax - ensure you are using the most recent Angular Fire release. As of this moment, the Firebase site offers the 1.1.3 CDN.

For more information, visit:

app.directive("sbCalendar", function () {
    return {
        link: function (scope, element, attrs) {
            scope.fireEvents.$loaded(function(){
                $(element).fullCalendar({
                    header: {
                        left: 'prev,next today',
                        center: 'title',
                        right: 'month,agendaWeek,agendaDay'
                    },
                    eventLimit: true, // shows "more" link for numerous events
                    aspectRatio: 4,
                    events: scope.fireEvents,
                    editable: true,
                    eventDrop: function (event, delta, revertFunc) {

                    } // event drop

                }); // fullCalendar initialization & options
            })

        } // link

    } // return 
}); // directive

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

Return user to the previous webpage upon successful login using Node

I am looking for a way to redirect users who are not logged in from an individual post's page to the login screen, and then back to the post after they have successfully logged in. Here is my login route: router.get('/login', function(req, ...

The ajax call resulted in a failed large file upload

Currently, I am focusing on implementing file upload functionality. I have developed a code snippet using an ajax call that works flawlessly when uploading files (GB) from my local server. $.ajax({ type: "POST", url: "process/uploadFlatFile.htm", ...

Refreshing a component within the ngrx/store

Currently utilizing @ngrx/store within my Angular 2 application. The store contains a collection of Book objects. I aim to modify a specific field within one of those objects. Additionally, there is an Observable representing the Book instance I wish to u ...

Scraping a few URLs with Javascript for Web Data Extraction

I'm struggling to retrieve data from multiple URLs and write it to a CSV file. The problem I'm facing is that the fetched data is not complete (I expect 10 items) and it's not in the correct order. Instead of getting 1, 2, 3 sequentially, I ...

When using Phonegap in conjunction with AngularJS ng-view, the full-screen mode cannot be

I have seen similar questions asked before, but none of the solutions I found have worked for me so far. Here are some key parts of my index.html file: <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, ...

Having issues with loading THREE.js object within a Vue component

I'm baffled by the interaction between vue and THREE.js. I have the same object that works fine in a plain JS environment but not in vue.js. The canvas remains empty in vue.js and the developer console displays multiple warnings. The code I used in J ...

Tips for programmatically inserting elements with data binding

Hi everyone, I'm relatively new to working with AngularJS and I have a question regarding dynamically adding elements to a page within a specific scope. For example, suppose we have the following HTML structure: <div id="cnt" ng-controller="main ...

Can we connect to an external PHP script using Ajax?

I'm attempting to utilize Ajax to call an external PHP script in the following manner: $(function() { $.ajax({'url': 'http://stokes.chop.edu/web/zscore/result.php', 'type': 'POST', & ...

What steps do I need to take to set up Vue-CLI 3 to generate a webpage with no JavaScript?

My dilemma is this: I have a simple static page that does not require JavaScript. Using vue-cli 3, I am attempting to pass the HTML file through webpack for minification purposes. Unfortunately, it seems that accomplishing this task is not as straightforwa ...

Using Node modules in the browser: A beginner's guide

Once you've used npm to install packages such as: $ npm install bootstrap or $ npm install angular these packages are typically stored in the "node_modules" directory. The question now arises, how do you link to or access them from an HTML page? U ...

How to showcase arrays using a variety of vibrant colors

In my web application, users input a paragraph and the backend system scans it to identify hard and very hard sentences. My goal is to display the entire paragraph with these difficult sentences highlighted in yellow and red backgrounds respectively, while ...

What could be causing my jQuery getJSON function to not execute the callback function as expected?

I'm facing an issue with my JavaScript code: $(document).ready(function(){ $("#EstadoId").change(function(){ listaCidade($(this).val()); }); }); function listaCidade(uf) { $.getJSON("@Url.Action("ListaCida ...

sending a parameter in the reverse url using JavaScript

coding in javascript let address = '{% url candidate_resume "cnd_id" %}'; address = address.replace("cnd_id",id); document.getElementById('cell2').innerHTML= '<a href="' + address + '"> View Resume < ...

Can I establish a specific instance ID for FCM?

I am currently working on a personal app that I will be the sole user of. Is there a way to establish a permanent FCM instance ID? I would like to avoid the hassle of constantly updating and sending the dynamic instance ID to the server. ...

Having difficulty uploading files using FormData in JavaScript, as $_FILES is returning empty

I have implemented a file upload feature to my server using JavaScript, but I am facing an issue with certain jpeg/png files where the $_FILES and $_POST variables are empty. Despite trying various solutions, I haven't been able to resolve this issue. ...

The Three.js Environment Experiencing Intense Tremors

Currently, I am immersed in a project that requires handling very large and very small distances utilizing three.js. Encountering an issue on the smaller side of the scene where the 'scene' begins to shake uncontrollably. Initially, I suspected ...

The error message "Cannot read property 'firestore' of undefined" is often encountered when

I developed an Angular application to test Firebase functions and deployed it on Firebase hosting. Almost everything is working except for the Firestore function, which is causing this error: main.8ae925009adf8b80e1bc.js:1 ERROR Error: Uncaught (in promis ...

Weapons of Mass Destruction - receive markdown content

My application is utilizing a markdown editor from Google Code. $(document).ready(function () { var converter = Markdown.getSanitizingConverter(); var editor = new Markdown.Editor(converter); editor.run(); }); <div class="wmd-panel"> ...

Array indexes can be negative

My approach to storing objects for a grid involves using a two-dimensional array. In this case, the grid is hexagonal, making it more convenient to utilize a coordinate system centered at (0, 0) and ranging from -r to r. The following source suggests that ...

Issue with Datepicker not updating when triggered by event handler

Having an issue with my material-UI datepicker where the date is not updating correctly when I try to select a new one. The initial value set in useState works fine, but I want the datepicker to smoothly update when I choose a different date. You can see a ...