简体   繁体   中英

EmberJS 2.0 How to avoid Dynamic Segments On route to be always undefined?

I want to access to the dynamic segment on a route but the params are always undefined.

I have the next route defined on the router:

this.route('send', {path: '/send/:solName/:id/:userId'}, function() {});

And In my route I have this:

    export default Ember.Route.extend({
        model: function (params){

        console.info(params);

        return {
             solName: params.solName,
             id: params.id,
             userId: params.userId
         }

        }
      });

Any idea why the params are always undefined?

It is normal.

The dynamic segment parameters would not passed to inner routes.

You need to use paramsFor method in send.index route to get params sent to the route.

Please check this twiddle out

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM