Ember cli Uncaught TypeError: undefined is not a function

Ember cli Uncaught TypeError: undefined is not a function

我是一个 ember 菜鸟,我最初构建我的应用程序时没有使用 ember-cli 它工作正常 然后我有了一个好主意,用 ember-cli 重建我非常简单的应用程序可能会出错:)

两个应用程序中的一切都一样,直到 ember 抛出错误并指向我的 verse 控制器中的第 52 行请记住,此文件在我的非 ember- 中完全相同cli 版本

更新我只是在第 52 行的地方放了很多空格,现在它说错误在第 53 行是空的:(((

import Ember from 'ember';

export default Ember.Controller.extend({
    sortProperties:["time"],
    sortAscending:true,
    start:new Date(),
    count:0,
    incorrect:0,
    startReview:true,
    showHighScores:false,

    actions:{

        startReview:function(){
            this.set('startReview',false);
            this.set("showHighScores",false);
            this.start = new Date();
            this.count = 0;
            this.incorrect = 0;
            console.log(this.count);
        },

        showHighScores:function(){
            this.toggleProperty("showHighScores");
        },

        checkCorrectness:function(word){
            var textArray = this.get("model.text").split(" ");
            var length = textArray.length;
            console.log(this.array);
            if(word === textArray[this.count]){

                console.log("correct");
                this.count++;
                console.log(this.count);
            }else{
                console.log("Incorrect");
                this.incorrect++;
            }
            if(length === this.count){
                var finish = new Date();
                var time = finish-this.start;
                var accuracy = (this.count/(this.count+this.incorrect)*100);
                alert("You took "+time/1000+" seconds! With "+accuracy+"% accuracy!");
                this.saveResult(time);
                this.set('startReview',true);
            }
        },
    },
    randomizer:function(){
        this.set("randomArray",this.get("model.text").split(" ").randomize());      
    **}.observes("startReview"),**//The offending line

    saveResult:function(timeTaken){
        var date = new Date(),
            userName = "TimTheGreat";


        var score = this.store.createRecord('score',{
            userName:userName,
            date:date,
            time:timeTaken,
            verse:this.get('model'),
        });

        var controller = this;
        var scores = controller.get("model.scores");
        score.save().then(function(score){
            scores.addObject(score).then(function(){
                controller.get("model").save();
            });

        });
    }
});

违规行实际上是之前的行。

this.set("randomArray",this.get("model.text").split(" ").randomize());

在 Ember 和本机 javascript 中,数组都没有 randomize 方法。这是您或您之前使用的其他库添加的内容。