Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide ability to bind state configuration to server side and refresh at runtime #19

Closed
jeme opened this issue May 8, 2013 · 1 comment
Labels
Milestone

Comments

@jeme
Copy link
Contributor

jeme commented May 8, 2013

Gives an alternative way to define states that can get reinitialized during runtime. Mainly to give the possibly for the server to define the configuration.

Reinitialization should integrate with websockets or a wrapper API that provides some fallback mechanism that does long polling or something, this is to let the client automatically detect if the server changes the route configuration.

@jeme jeme modified the milestones: 0.6.2, 1.0 Apr 22, 2014
jeme added a commit that referenced this issue Apr 22, 2014
@jeme
Copy link
Contributor Author

jeme commented Apr 22, 2014

Added overload to allow for:

$state.state(['$register', '$http', function(reg) {
    return $http.get().success(function(data) {
      reg('statename', { /*  use data to configure */ });
    });
}]);

where $register is equivalent to the old $state.state.
The function that can be provided to state is inject-able and can therefor take e.g. $http to load states from the server.

Note that in such cases, it should return a promise that resolves when the registration is done.
The registrations can be rerun using $state.reinitialize().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant