How to send data using form on ionic


hi people I am a new using ionic,
I need to send data using form but not working check my code please

<!-- show modal -->
<script id="contact-modal.html" type="text/ng-template">
    <div class="modal">
            <button type="reset" class="button button-clear" ng-click="closeModal()">
                <i class="ion ion-close"></i>
            <form ng-submit="saveCart(product)">
                <div class="row">
                    <div class="list">
                        <div class="col-50 zupa_left zupa_img_pro">
                            <img ng-src="{{img}}" alt="zupa"/>
                            <p>{{price}} Bs.</p>
                        <div class="col-50 zupa_left zupa_spin">
                           <!-- <ng-touch-spin ng-model="product.cant"  initval="0"  step="1">
                            <input type="text" initval="0" step="1" ng-model="product.cant" ng-touch-spin>
                        <input type="hidden" value="{{price}}" ng-model="product.price" />
                        <input type="hidden" value="{{id_item}}" ng-model="product.iditem" />

                <div class="row">
                    <div class="zupa_btn_cart">
                        <div class="text-center">
                            <button type="reset" class="button button-assertive" ng-click="closeModal()"><i class="ion ion-close"></i></button>
                            <button type="submit" class="button  button-positive"><i class="ion ion-ios-cart"></i></button>


I need to send data of (product.cant, product.price, product.iditem) and this is my controller code

$scope.saveCart = function(product){
$scope.products = {id_item:product.iditem, val:product.cant, price:product.price};
whe my controller recived (var product) this show me an error of the ( TypeError: Cannot read property ‘cant’ of undefined ) and the semething the other var.

Please help me wich is my error


Did you define product in your controller as a scope variable, something like:

$scope.product = { id_item: 1, img: 'path/to/image', description: 'A product', price: 23.45, .... };

If not, the saveCart function simply gets an undefined object which has no properties at all (which would explain the message ‘cannot read property x of undefined’).