lundi 20 mars 2017

Ember.js - Update view only if my data is upload into the server

I just want that my view doesnt update anything (when i create me new task) until the data is upload it into the server

actions: {
  addTask: function(){

    var title = this.get('title');
    var description = this.get('description');
    var date = this.get('date');


     var newTask = this.store.createRecord('task',{
         title: title,
         description: description,
         date: isValidDate
       });


       var self = this;
       //Save to firebase
       newTask.save().then(function(){

            //clear Form after update database
          self.setProperties({
            title: "",
            description: "",
            date: ""
          });
        });

     }

  }

and this is my view

<h1>Tasks</h1>

  <div class="well">
    <h4> </h4>
    <small>Due: </small>
    <p></p>

  </div>


i try to to add {backgroundReaload: false} in the route but i think that i misunderstood for what is for

model: function(){
    return this.store.findAll('task',{ backgroundReload: false });
  }




Aucun commentaire:

Enregistrer un commentaire