AnsweredAssumed Answered

App not usable in custom view

Question asked by Artis Plocins on Feb 19, 2018
Latest reply on Feb 19, 2018 by Artis Plocins

I've created an application-level (global) custom view that needs to get the current user's preferences and teams.

 

JavaScript console in my browser shows me that at the time of the view's initialize function, app.events is not available, app.user is a nearly empty user (almost no attributes that you see when you look at App.user in the console when  the app has loaded) and even app.user.get() is an undefined function...

 

({
    initialize: function(options) {
        this._super("initialize", [options]);

        app.events.on('app:start', function() {
                console.log('App started.');
        });

        this.defaultTeam = app.user.getPreference('default_teams')[0];
        this.teams = app.user.get('my_teams');
    }
})

 

How can I get access to the app, user and preferences as normal in my custom view?

Outcomes