examples/blog/public/components/blog.js
function (event) {
      event.preventDefault();
      var collection = this.getCollection();
      var id = this.state.id;
      var model;
      if (id) {
        // Update existing model
        model = collection.get(id);
        model.save(this.state, {wait: true});
      } else {
        // Create a new one
        collection.create(this.state, {wait: true});
      }
      // Set initial state
      this.replaceState(this.getInitialState());
    }
function (event) {
      event.preventDefault();
      var collection = this.getCollection();
      var id = this.state.id;
      var model;
      if (id) {
        // Update existing model
        model = collection.get(id);
        model.save(this.state, {wait: true});
      } else {
        // Create a new one
        collection.create(this.state, {wait: true});
      }
      // Set initial state
      this.replaceState(this.getInitialState());
    }
function ( event ) { event . preventDefault ( ) ; var collection = this . getCollection ( ) ; var id = this . state . id ; var model ; if ( id ) { // Update existing model model = collection . get ( id ) ; model . save ( this . state , { wait : true } ) ; } else { // Create a new one collection . create ( this . state , { wait : true } ) ; } // Set initial state this . replaceState ( this . getInitialState ( ) ) ; }
Save the new or existing post to the services
Save the new or existing post to the services