错误" this.push不是函数"棱角分叉的Foreach

时间:2016-07-27 14:05:10

标签: javascript angularjs

当我执行我的功能时,我收到此错误" this.push is not a function"是什么造成的?这不是我第一次使用Angular forEachthis.push

$scope.search_subCategory_businesses= function()
        {
            alert("tigidi tigidi subcategory");
            //$scope.busi_es = sharedProperties.getProperty();
            $scope.busi_es=JSON.parse(window.localStorage.getItem("biz"));
            window.localStorage.removeItem("biz");
            console.log("sharedProperty hahahaah is",$scope.busi_es);

            angular.forEach($scope.busi_es,function(value,key)
            {
                            $scope.business = value;

                            if($scope.business.logo == '' || $scope.business.logo==null)
                            {
                                $scope.business.logo=config.BaseImageURL+"uploads/defbanner.png"
                            }else
                            {
                                $scope.business.logo=config.BaseImageURL+$scope.business.logo;
                            }
                            this.push($scope.business); //complaings

            },$scope.businesses);
            //return $scope.businesses;

        };
        $scope.search_subCategory_businesses();

0 个答案:

没有答案