You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
There are some questions that may be not documented well enough when it comes to the
@InjectViewModel
annotation.@Inject
instead of@InjectViewModel
to get the viewModel instance?@InjectViewModel
is used?@Inject
you could inject ViewModels of other types@InjectViewModel
is used@Inject
for other dependencies in the View or ViewModel?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.
The text was updated successfully, but these errors were encountered: