I am trying to add model to view by injection
val model = PersonModel by inject()
but error:
'PersonModel' does not have a companion object.
What am i doing wrong ?
I am trying to add model to view by injection
val model = PersonModel by inject()
but error:
'PersonModel' does not have a companion object.
What am i doing wrong ?
Copyright © 2021 Jogjafile Inc.
You need to use
:
, not=
.The reason for the error is that, when the compiler sees
val model = PersonModel
, it assumes you're trying to assign the companion object of thePersonModel
class tomodel
, but there isn't one, so it gives you the most helpful message it can, not realizing you made a simple syntax mistake.