JavaScript Meteor - How to correctly route inside Template event function

I have a base template:

<template name="ApplicationLayout">
    {{> yield}}
</template>

and I route templates into it using Iron Router, like so:

Router.configure({
  layoutTemplate: 'ApplicationLayout',
  notFoundTemplate: 'home'
});
Router.route('/', function () {
  this.render('home');
});

Whenever someone arrives at the site, they'll always be shown the agegate template. Once they click the submit button, I want to change to a different page (home).

Template.agegate.events({
    "click #submit": function (event) {
        this.render('home');
    }
});

The routing actually works (I get to the desired page), but it throws an error:

Uncaught TypeError: undefined is not a function

I'm assuming this is because the this in this.render('home') refers to the current template, whereas it needs to refer to the parent template (the ApplicationLayout template). However I don't know how to do that, or if that's even relevant.

So, how to can I correctly route inside a Template event function?

Answer:1

Hi there my code is quite simple but Id like for the design purposes to keep everything neat , at the moment Im pulling all the description which is like Some could be huge others can be quite small , ...

Hi there my code is quite simple but Id like for the design purposes to keep everything neat , at the moment Im pulling all the description which is like Some could be huge others can be quite small , ...

  1. read more from database

EDIT, new code based on Mottie's answer: jQuery.tablesorter.addParser({ id: "monetaryValue", is: function (s) { return false; }, format: function (s) { return s.replace('$'...

EDIT, new code based on Mottie's answer: jQuery.tablesorter.addParser({ id: "monetaryValue", is: function (s) { return false; }, format: function (s) { return s.replace('$'...

  1. jquery tablesorter sorting string
  2. jquery tablesorter sort by data attribute
  3. jquery tablesorter sort icon
  4. jquery tablesorter sort date
  5. jquery tablesorter sort multiple columns
  6. jquery tablesorter sort two columns
  7. jquery tablesorter sort only one column
  8. jquery tablesorter sort
  9. jquery tablesorter sort image
  10. jquery tablesorter sort numbers
  11. jquery tablesorter sort column
  12. jquery tablesorter sort datetime
  13. jquery tablesorter sort by attribute
  14. jquery.tablesorter sort by date time
  15. jquery tablesorter sort alphanumeric
  16. jquery tablesorter sort initial order
  17. jquery tablesorter sort on hidden column
  18. jquery tablesorter sort on load
  19. jquery tablesorter sort checkbox
  20. jquery tablesorter sort not working

Sorry, for that (but I´m a regex noob) in js how would one replace the first folder in a url string. Pseudo Code: Replace at start of string: /any-amount-of-characters/ with nothing Examples $...

Sorry, for that (but I´m a regex noob) in js how would one replace the first folder in a url string. Pseudo Code: Replace at start of string: /any-amount-of-characters/ with nothing Examples $...

  1. regex replace first occurrence
  2. regex replace first character
  3. regex replace first and last character
  4. regex replace first group
  5. regex replace first occurrence python
  6. regex replace first line
  7. regex replace first character if
  8. regex replace first 5 characters
  9. regex replace first character with uppercase
  10. regex replace first letter to uppercase
  11. regex replace first occurrence of character
  12. regex replace first space with comma
  13. regex replace first character lowercase
  14. regex replace first capture group
  15. regex replace first occurrence c#
  16. regex replace first n characters
  17. regex replace first two characters
  18. regex replace first 3 characters
  19. regex replace first tab
  20. regex replace first comma

What are the scenarios when you want to use CDN to load a javascript file? And which files you might want to lazy load. Or perhaps which scripts are the best candidate to be combined and minified? ...

What are the scenarios when you want to use CDN to load a javascript file? And which files you might want to lazy load. Or perhaps which scripts are the best candidate to be combined and minified? ...