I am currently working on a feature where each contact in the collection will have specific values such as first name, last name, and email. Whenever a contact is selected from the list, I want it to redirect to a second page where all the details for that contact are displayed.
At the beginning of my Contact.js file, I've included this code...
Router.route('/post/:_id', function () {
this.render('Post', {
data: function () {
return Contax.findOne({_id: this.params._id});
}
});
});
In addition, here is the event handler for when a particular contact is clicked...
Template.aCont.events({
"click #view": function() {
Router.go('/post/:' + this._id);
}
});
Lastly, here is the relevant HTML snippet...
<template name="contDeets">
<ul class="list-group">
<li class="list-group-item">{{this.firstName}}, {{this.lastName}}</li>
</ul>
</template>
<template name="Post">
{{#contentFor "headerButtonLeft"}}
{{>ionNavBackButton}}
{{/contentFor}}
{{#contentFor "headerTitle"}}
<h1 class="title">Contacts</h1>
{{/contentFor}}
{{#contentFor "headerButtonRight"}}
<a id="add" class="button button-clear button-positive" href='/add'>Add</a>
{{/contentFor}}
{{#ionView}}
{{#ionContent}}
<div id="contactList2">
{{> contDeets}}
</div>
{{/ionContent}}
{{/ionView}}
</template>
There seems to be an issue with my code. Although it opens a new page with the correct URL, the information that should be displayed ({{this.firstName}}, {{this.lastName}}) is not appearing correctly except for the comma. What could be causing this problem?