JS - 카트

2461 단어





    
     
    
    
        var app = angular.module("myApp", []);
        app.controller("myctrl", function ($scope) {
            $scope.goods = [
                {"id": 124, "name": "iphone", "price":"¥:5400", "num": 55,},
                {"id": 154, "name": "ipad", "price": "¥:2300", "num": 25,},
                {"id": 125, "name": "ionic", "price": "¥:9400", "num": 85,},
                {"id": 185, "name": "Andriod", "price":" ¥:3800", "num": 10,},
            ];
            $scope.bold = "bold";
            $scope.title = 'name';
            $scope.desc = 0;
            $scope.key = '';

            // 
            $scope.deletes =function(name){

                var p;
                for( index in     $scope.goods){
                    p = $scope.goods[index];
                    if( p.name == name){
                        $scope.goods.splice(index,1);
                        alert(" "+name+" ");
                    }

                }

            };
            $scope.delall =function(){
                alert(" ");
                $scope.goods.splice($scope.goods);
            };

            // title 
            $scope.togg =function(tit){
                $scope.title = tit;
                $scope.desc = !$scope.desc;

            };

        });

    



{{x.id}} {{x.name}} {{x.price}} {{x.num}}

좋은 웹페이지 즐겨찾기