Angularjs 当选中复选框时,如何向购物车添加并列出项目?

Angularjs 当选中复选框时,如何向购物车添加并列出项目?,angularjs,Angularjs,我需要一些东西,如贝娄。当我点击复选框,应添加到购物车与我已检查的项目的所有细节应该是购物车上的列表。我如何才能实现它 <div ng-app="MyApp" ng-controller="MyCart" > <div ng-repeat="x in names"> <input type="checkbox" name="item">{{x.item}} {{x.price}} </input> </div> <div>

我需要一些东西,如贝娄。当我点击复选框,应添加到购物车与我已检查的项目的所有细节应该是购物车上的列表。我如何才能实现它

<div ng-app="MyApp" ng-controller="MyCart" >
<div ng-repeat="x in names">
<input type="checkbox" name="item">{{x.item}} {{x.price}} </input>
</div>
<div>
 <h1>Cart</h1>
        <div>Ex. Order Summary 100 
        //here i need to show the order price </div>
             <div>
           EX.  1.xxx Rs.10
                2.yyy rs.90
        //Here i need to list the items which are checked on the above 
        </div>
        </div>
            </div>
    <script>
    angular.module('MyApp', [])
    .controller('MyCart', ['$scope', '$http', function($scope, $http) {
        $http.get('AngularJs-Response.jsp').success(function(response) {
            $scope.names = response;      
          });     
    }]);
    </script>

{{x.item}{{x.price}}
运货马车
例:订单汇总表100
//这里我需要显示订单价格
例1.xxx Rs.10
2.yyy rs.90
//这里我需要列出上面检查的项目
angular.module('MyApp',[])
.controller('MyCart',['$scope','$http',函数($scope,$http){
$http.get('AngularJs-Response.jsp').success(函数(响应){
$scope.names=响应;
});     
}]);
工作小提琴,

您的问题不清楚。你需要更具体地描述你想要实现的目标。似乎你想让某个人代你编写控制器我想实现的是。当我选中一个复选框时,该项目应该在购物车中列出详细信息?
<div ng-app="myApp" ng-controller="startCtrl">
    <div ng-repeat="x in names">
        <input type="checkbox" ng-model="item.isSelected" ng-change="value(item.isSelected,x)"/>{{x.name}} {{x.price}}
    </div>
    <hr/>
    <div>Selected Item</div>
    <div ng-repeat="y in selectedItems" ng-show="selectedItems.length>0">
        {{y.name}}----{{y.price}}
    </div>
    <div ng-show="selectedItems.length<=0"> No item selected </div>
</div>
var app=angular.module("myApp",[]);
app.controller("startCtrl",function($scope){
    $scope.names=[{name:"mobile",price:"100"},{name:"Laptop",price:"200"},{name:"bag",price:"50"}];

$scope.selectedItems=[];    
$scope.value=function(isSelected,item)
{


        if(isSelected==true)
        {
            $scope.selectedItems.push(item);
        }
        else
        {
                console.log(item.name);              angular.forEach($scope.selectedItems,function(itemRmv,$index){
                if(itemRmv.name==item.name)
                {
                    $scope.selectedItems.splice($index,1);
                }
            })
        }
   }
});