How to access query parameters from route in Ember 1.7

后端 未结 5 482
傲寒
傲寒 2020-12-16 12:08

In 1.7 Ember should support Query Parameters. I have no problems using them in controller but I\'d like to access them in Route, ideally in beforeModel hook but model hook w

5条回答
  •  长情又很酷
    2020-12-16 12:27

    In latest ember version you can get the value in Route as

    import Ember from 'ember';
    export default Ember.Route.extend({
      beforeModel(params){ 
          console.log(params.queryParams.test); //if the parameter contains test as the key
      }
    });
    

    This works only if the locationType is auto in your environment.js file.

提交回复
热议问题