Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between router and route in Emberjs

Tags:

ember.js

What is the difference between router and route in emberjs? I wanted an implementable explanation if possible


1 Answers

Router - ember application will have one Router, it manages transitions between routes and it contains map of all routes. You specify map of routes like so:

App.Router.map(function(){
  this.route('post', { path: '/post/:post_id' }, function() {
    this.route('edit');
    this.route('comments', { resetNamespace: true }, function() {
      this.route('new');
    });
  });
});

from which Router is able to identify structure of routes and their accepting params. It activates corresponding Route when you navigate to particular path/url in browser ember router docs

Route - for each path/route you will have Route object, when you change path/url in browser corresponding Route gets activated for that path and set up everything (controller, template) which relate to that route (that has same name usually). ember route docs

read more

like image 76
Bek Avatar answered Nov 29 '25 10:11

Bek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!