Skip to content

Best Practice for Loading Global App State #1780

@davydotcom

Description

@davydotcom

No one seems to know the answer here. What is the best practice for loading a global app state?

Currently using ember-rails style setup except with latest github ember and ember-data.

Example, In my main application view I have a headline that shows the current Company name, (or current user name for that matter). How do I populate this information in the view globally?

Example I have an application view:

<h1>{{companyName}}</h1>
<div>
  {{outlet}}
</div>

Controller:

App.ApplicationController = Ember.Controller.extend
  companyName: "Loading..."

  loadCompanyName: ()->
    $.ajax
      url: '/company'
      dataType: 'json'
      success: (response) ->
        this.set 'companyName', response.data.companyName

Where and how would i fire loadCompanyName? It isn't specific to a route. It is global

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions