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

Extend docs for @InjectViewModel vs. @Inject for CDI/Guice projects #252

Closed
manuel-mauky opened this issue Jun 1, 2015 · 0 comments
Closed

Comments

@manuel-mauky
Copy link
Collaborator

There are some questions that may be not documented well enough when it comes to the @InjectViewModel annotation.

  • Can you use @Inject instead of @InjectViewModel to get the viewModel instance?
    • Answer: No you can't, more specificially: You shouldn't because they aren't identical
  • What is the difference? What is done when @InjectViewModel is used?
    • you can only inject the correct ViewModel for the View type, with @Inject you could inject ViewModels of other types
    • ResourceBundles can be injected into the ViewModel only when @InjectViewModel is used
    • existing ViewModel instances can be used when loading a View. This VM instance couldn't be injected with CDI/Guice
  • Can you use @Inject for other dependencies in the View or ViewModel?
    • yes you can: Both the View and the ViewModel are taken from the DI container and therefore are managed by the DI container

We should describe these Q&A stuff in the wiki documentation. Additionally we should describe the internal Steps when a view is loaded so that the user can better understand what is happening.

@manuel-mauky manuel-mauky changed the title Extend docu for @InjectViewModel vs. @Inject for CDI/Guice projects Extend docs for @InjectViewModel vs. @Inject for CDI/Guice projects Jun 1, 2015
@manuel-mauky manuel-mauky added this to the 1.4.0 milestone Jun 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant