Correct way to call a component function in view

Hey everyone,

I am stuck in a situation where I am trying to get the output of a component to be shown in the view form as a dropdown. I cannot use model to store the data from the component output and show it in the view. As that will result in a huge data storage and might slow the application processing. The only option left is to directly use this component output in view.

Now, I am confused if I should call this output in controller and from controller I call the controller method in view like here: http://www.yiiframework.com/forum/index.php/topic/63169-way-to-call-controller-method-in-view-yii2/

But I guess that violates the MVC rules.

The other way is to use JS in frontend and use the component output shown there in the view. Not sure if this is a good way either. Any input is appreciated.

Widgets?

Yup, thats the way to go. Thanks samdark.

Not sure how I will have to attach the output from the component to widget but there is a possibility. :D