Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your problem is coused by the fact that remote methods, i.e. those which will be called on the server, don't simply return any value. Instead, they accept a callback that will be used to process the returned value (see <a href="http://docs.meteor.com/#meteor_call" rel="nofollow">docs</a>). So in your first example you should probably do something like this:</p> <pre><code>Template.createDialog.events({ 'click #btn-dialog-create': function (event, template) { Meteor.call('create', function (error, result) { if (!error) appRouter.navigate("object/id/" + result, {trigger:true}); }); } }); </code></pre> <p>You also said:</p> <blockquote> <p>I want the client to be as responsive as possible, therefore i'm trying to utilize Meteor's abillity to update the client immediately without waiting for a server confirmation.</p> </blockquote> <p>I think that in this case you should definitely wait for server response. Note, that there is no chance you get the correct object <code>id</code> unless this is given to you by the server.</p> <p>One possible way to get around this issue is to create a local (client-side) collection:</p> <pre><code>// only on client var temporary = new Meteor.Collection(null); // null name </code></pre> <p>in which you could store your "temporary" newly created objects, and then save them to the "real" collection after the user clicks the <code>save</code> button. You could implement your router to respond to urls like <code>object/new/*</code> to get access to these objects before they're saved to your database.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload