Skip to content

this.paramsFor(routeName) with the routeName of a route not previously visited #13771

Closed
@fknoll

Description

@fknoll

Using

Ember      : 2.6.1
Ember Data : 2.6.1
jQuery     : 2.2.4

It seems like using this.paramsFor(routeName) with the routeName of a route not previously visited makes my application fail - not immediately, but later on, when I transition to the route.

When starting my application, I want automatically to show a specific route reg directly nested under the application route.

For route reg I have defined two query parameters - queryParam1 and queryParam2.

In the model() method for application route the default values for those two query parameters are found and saved in defaultQueryParam1 and defaultQueryParam2.

To secure that the navigation to route reg is not already requested via the url http://localhost:4200/reg?queryParam1=xxx&queryParam2=yyy, I am testing for the existence of the query parameter values before requesting the default transition to reg.

For that purpose I have defined

redirect() {
    if ( Ember.isEmpty( this.paramsFor('reg').queryParam1 ) &&
         Ember.isEmpty( this.paramsFor('reg').queryParam2) ) {

      this.transitionTo('reg', {
        queryParams: {
                        queryParam1: this.get('defaultQueryParam1'),
                        queryParam2: this.get('defaultQueryParam2')
                      }
      });

    } // end-if
  },

When using the url http://localhost:4200/reg?queryParam1=xxx&queryParam2=yyy, everything seems to work nice and smoothly.

However, when I use the default start application url http://localhost:4200/ I get this two fatal errors:

ember.debug.js:27773
Error while processing route: regSummary.index delegate is not a function TypeError: delegate is not a function
    at Class._qpChanged (http://localhost:4200/assets/vendor.js:33405:7)
    at Object.apply (http://localhost:4200/assets/vendor.js:32605:18)
    at Object.sendEvent (http://localhost:4200/assets/vendor.js:26069:28)
    at notifyObservers (http://localhost:4200/assets/vendor.js:29972:25)
    at propertyDidChange (http://localhost:4200/assets/vendor.js:29799:5)
    at Object.notify (http://localhost:4200/assets/vendor.js:23823:9)
    at chainsDidChange (http://localhost:4200/assets/vendor.js:29888:9)
    at Object.propertyDidChange (http://localhost:4200/assets/vendor.js:29798:5)
    at Object.set (http://localhost:4200/assets/vendor.js:30199:38)
    at http://localhost:4200/assets/vendor.js:36057:37logError @ ember.debug.js:27773
ember.debug.js:31387
TypeError: delegate is not a function
    at Class._qpChanged (ember.debug.js:23279)
    at Object.apply (ember.debug.js:22479)
    at Object.sendEvent (ember.debug.js:15943)
    at notifyObservers (ember.debug.js:19846)
    at propertyDidChange (ember.debug.js:19673)
    at Object.notify (ember.debug.js:13697)
    at chainsDidChange (ember.debug.js:19762)
    at Object.propertyDidChange (ember.debug.js:19672)
    at Object.set (ember.debug.js:20073)
    at ember.debug.js:25931

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions