JSFiddle - React, Tailwind, and code Playground

by Mike McCaughan

HTML

<div ng-app="Demo"></div>

JavaScript

// Create an application module for our demo.
        var app = angular.module( "Demo", [] );


        // -------------------------------------------------- //
        // -------------------------------------------------- //


        // I control the root of the application.
        app.controller(
            "AppController",
            function( $scope, $q ) {
console.log('s');
                // The $q.reject() method creates a promise that is immediately rejected
                // with the given reason.
                $q.reject( "meh" ).catch(
                    function handleReject( reason ) {

                        console.log( "Rejected with reason:", reason );

                    }
                );

                // The $q.when() method creates a promise that is immediately resolved
                // with the given value.
                // --
                // NOTE: If the given value is already a promise then it will be properly
                // chained (and routed) by the resultant promise.
                $q.when( "woot!" ).then(
                    function handleResolve( value ) {

                        console.log( "Resolved with value:", value );

                    }
                );

            }
        );