O'Reilly logo

Ember.js Cookbook by Erik Hanchett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using query parameters

Query parameters allow you to use the URL for the application state. In these recipes, we'll use query parameters in several different ways to show how it works.

How to do it...

Query parameters are optional key-value pairs. They will appear to the right of ? in a URL.

  1. In a new project, generate a new application controller:
    $ ember g controller application
    

    The application controller will be generated in the app/controllers folder.

  2. Update the application controller with a new queryParams for student:
    / app/controllers/application.js
    import Ember from 'ember';
    
    export default Ember.Controller.extend({
        queryParams: ['student'],
        student: null
    });

    This will set up the binding between the student query parameter in the URL and the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required