lundi 9 janvier 2017

Same action call on on Button in ember cli,But actions are different

I have two actions wirte in controller of ember cli and two buttons in template handelbar,First when i clicked first button(confirm) then resource hit(POST request) properly and when we Send PUT request on Second Button(Cancel)...when i click, then it hits only POST REQUEST ,Which i previously hit request(PUT request). But when we do browser referesh then.It works properly(PUT REQUEST On CANCEL BUTTON). i am using ember-cli 1.12 version helping out.

Template.hbs

<button class="pointer btn btn-xs btn-dark-default shadow-btn" >Confirm</button>

<button class="btn btn-xs btn-danger-default shadow-btn" >CANCEL</button>


controller.js

cancelGrn:function(item){
        console.log('this is cancel request');
       var self = this;
       item.set('isDelete',true);
       item.set('amountType',"NONE");
        item.save().then(function() {
            self.notifications.showSuccess("GRN Cancel Request Sent",      {
                location: "top",
                delay: true,
                autoClose: true
            });
            self.get('grns').reload();

        });

    },


    cancelGrn:function(item){
        console.log('this is cancel request');
       var self = this;
       item.set('isDelete',true);
       item.set('amountType',"NONE");
        item.save().then(function() {
            self.notifications.showSuccess("GRN Cancel Request Sent", {
                location: "top",
                delay: true,
                autoClose: true
            });
            self.get('grns').reload();

        });

        },




Aucun commentaire:

Enregistrer un commentaire