(3)前端項目AngularJS的第三部分總結

現在出現了一個問題,我先擺出來:一個Price對象的getPriceUnderway方法,只會返回一個對象或者null,在測試函數內部的數據,沒問題;但是在另一個Controller.js裏面調用時,這個方法返回了undefined,還沒搞清楚緣由,代碼如下————

Price.getPriceUnderway = function(){
 
    var activities = Activity.getActivities();
    _.each(activities,function(ele){

        var item = JSON.parse(localStorage.getItem(ele + '_price')) || [];//But this is a Array.Array
 
        if(item.length != 0){
 
            if(item[item.length - 1].price_state == Price.state_set.starting){
 
                   return item.pop();  
            }
        }
        return null;
    });
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章