Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Aug 2010
    Posts
    25
    Vote Rating
    1
    Frank345 is on a distinguished road

      0  

    Default Beta2: this.application is undefined in Ext.app.Controller.launch()

    Beta2: this.application is undefined in Ext.app.Controller.launch()


    Hi,

    I am accessing this.application within the controller's launch() function.
    This worked with pr3 and earlier releases.
    Isn't this.application supposed to be available within all controller functions?
    But it seams to be undefined within launch(). This is my code...

    Code:
    Ext.define('app.controller.MyController', {
        extend: 'Ext.app.Controller',
    
        launch: function() { // called after the launch method of Application is executed.
            this.application.on({...}); // --> Uncaught TypeError: Cannot call method 'on' of undefined
           // ...
        },
    });
    Best regards,
    Frank

  2. #2
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    9
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    Use this.getApplication()

    As a general rule, all properties in your Sencha Touch 2 code should go through a getter function like getApplication
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  3. #3
    Sencha User
    Join Date
    Aug 2010
    Posts
    25
    Vote Rating
    1
    Frank345 is on a distinguished road

      0  

    Default


    this.getApplication() does the job.
    Thank you very much,
    Frank

Thread Participants: 1

Tags for this Thread