Closed HoldYourWaffle closed 4 years ago
Whoops I just noticed I created this issue in the wrong repository. Sorry...
You should inject MyModel
into the scope and set the desired values on it. Alternatively, create MyModel
manually, set values on it and set it into the scope (scope.set(MyModel())
). Now you can just inject it into any other view or controller in the same scope, and you have access to your data. Using param
is almost never the best solution. I believe this is pretty well covered in the guide, have you had a look at it?
Creating the model manually and inserting it into the scope did the trick for me, thanks!
I have read the guide extensively. Most parts are great, but I was honestly pretty confused by the whole injection section. This was the first time I've had to deal with something like this, so maybe that's just because of my lack of basic knowledge on the subject.
I'm trying to implement a basic MVC pattern for a long running calculation loop 'streaming' data into a linechart. I'm very new to this stuff so I could just be missing something very obvious here.
MyView
is the view that contains the chart. It receives anAssignment
andDataset
from previous steps.MyModel
is the model that contains some properties for controlling the calculation process. Finally,MyController
is the controller that handles the calculation and adds the new data to the chart data.Although this kind of injection is a new concept to me, I think I have wrapped my head around it pertty well now. However, I can't figure out how to pass the
Assignment
andDataset
fromMyView
toMyModel
(and thereby toMyController
). It receives theAssignment
andDataset
via theparam
delegate in the view. At least, that was the plan. As soon as I start the calculation I get the following error:As far as I can tell I did in fact pass the
dataset
parameter (on the marked line). Am I missing something obvious here? Am I using this whole injection thing wrong? I've been searching for hours now but I can't figure it out.Here's a (slimmed down) version of my code:
Any help would be greatly appreciated!