jeudi 23 mars 2017

onClick action not working in Route in EmberJS

I have a button which increase the value of quantity. i wrote the onclick action to increase the value of this quantity in the route.But this does not work, the onclick in not working and this does not give out a error as well.

i am new to EmberJS so please help.

This is the code which i tried.

My route.js

  actions: {
    increaseRequiredQuantity() {

        debugger;
        $('.qtyplus').click(function (e) {
            e.preventDefault();

            fieldName = $(this).attr('field');

            var currentVal = parseInt($(this.parentElement).find('input[name=' + fieldName + ']').val());
            var currentNewVal;

            if (!isNaN(currentVal)) {
                currentNewVal = currentVal + 1;
                $(this.parentElement).find('input[name=' + fieldName + ']').val(currentNewVal);
            } else {

                $(this.parentElement).find('input[name=' + fieldName + ']').val(0);
            }

        });
    }
}

this is how am calling the action from the template

<button type="button" class="btn btn-default btn-number qtyplus" data-type="plus" field='quantity' id="btnIncrease"><span class="glyphicon glyphicon-plus"></span></button>




Aucun commentaire:

Enregistrer un commentaire