demiters
demiters

Reputation: 646

What is the difference between these two forms of Iron Router's Router.route?

I've seen two forms that basically seem to do the same thing, given a template called 'index'. What are the differences between them?

First:

Router.route('index', {
  path: '/'
});

Second:

Router.route('/', function(){
  this.render('index');
});

Upvotes: 1

Views: 27

Answers (1)

Elie Steinbock
Elie Steinbock

Reputation: 5088

In this case there's probably no difference. It's two ways to do the same thing. It's a question of syntax. The first syntax is clearly simpler in this case though.

There might be other cases where there are certain things you can do with one syntax that you can't do with the other syntax, but I don't remember an example off the top of my head.

Upvotes: 1

Related Questions