未定义的变量脚本中的错误

时间:2014-01-17 10:27:33

标签: javascript ember.js

我无法访问块中所需的变量,如图所示。我不明白为什么。

define("appkit/controllers/me", ["appkit/utils/uploader", "exports"],
    function (__dependency1__, __exports__) {
        "use strict";
        var Uploader = __dependency1__["default"];
        var MeController;
        MeController = Em.ObjectController.extend({
            username: null,
            actions: {
                uploadProfilePic: function ($el) {
                    /*
                     * PROBLEM:
                     * 
                     * I dont understand why variable `Uploader` is not accessible over here.
                     * Could some one please explain?
                     * 
                     */
                     uploader = new Uploader(); // This line says "ReferenceError: Uploader is not defined".
                }
            }
        });

        __exports__["default"] = MeController;;
    }
);

我做错了什么?

有人可以解释一下原因吗?

1 个答案:

答案 0 :(得分:0)

在我看来,你声明了一个变量Uploader,但是你试图将它的一个实例实例化,就像它是一个类一样。