Require not working when used in jupyter/ipython notebook

Viewed 901

When I write the following code in jupyter opened from my system, it is working, but when I open it from another system it is not. The problem is with require(it is not running). I have put some consoles to see where it is stopping and it is running till console.log(require.s.contexts._.defined). I have checked the modules with this console and angular seems to be missing in this. Thanks in advance.

%%javascript
require.config({
    paths: {
        velocity: "https://cdn.jsdelivr.net/velocity/1.2.3/velocity.min",
        interact: "https://cdn.jsdelivr.net/interact.js/1.2.6/interact.min",
        angular: "https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min"
       },
    shim: {
        'angular': {
            exports: 'angular'
        }
    }
});
function start_application(data) {
//     console.log("data ready")
    console.log(require.s.contexts._.defined)
    require(['angular', 'jquery'], function(angular,$) {
        console.log("require running")
        $.ajax({url: "http://localhost:8889/tree/Jupyter_Angular/DQAForm.html", 
          success: function(result) {
//             console.log("SUCCESS")
//             console.log(result);
            $("#DQAFormContainer").html(result)
            var el = document.getElementById("dqaBrickContent");
            if(angular.element(el).injector()){
                angular.element(el).injector().get('$rootScope').$destroy()
            }
            var dqaBrick = angular.module('dqaBrick', []);
            dqaBrick.controller('dqaBrickCtrl', ['$scope', function ($scope) {
                $scope.myVariable = 'Starting new DQA Brick';
                console.log($scope.myVariable);
                $scope.showPanel = 1;
                $scope.openPanel = function (panelNum) {
                    $scope.showPanel = panelNum;
//                     console.log(panelNum);
                }
            }]);
            angular.element(document).ready(function() {
                angular.bootstrap(el, ['dqaBrick']);
            });
          }
        });
    })
}
var callbacks = {
    iopub : {
        output : start_application
    }
}
var kernel = IPython.notebook.kernel
kernel.execute('print("This is the starting")', callbacks)
0 Answers
Related