在jupyter / ipython笔记本中使用时不需要工作

时间:2017-07-26 14:38:51

标签: requirejs jupyter-notebook ipython-notebook

当我在从我的系统打开的jupyter中编写以下代码时,它正在工作,但是当我从另一个系统打开它时它不是。问题在于require(它没有运行)。我已经放了一些控制台来查看它停止的位置,它一直运行到console.log(require.s.contexts ._。defined)。我用这个控制台检查了模块,并且在这里似乎缺少角度。提前谢谢。

%%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 个答案:

没有答案