S
S
Sergey Beloventsev2017-09-06 14:21:15
Yii
Sergey Beloventsev, 2017-09-06 14:21:15

How to include javascript in a module?

Assets do not interest me at all, I need to operate javascript in a module.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-09-11
@Sergalas

In a view where this or that js is needed, regardless of whether it is a module or not, you can do this:
Only the modules usually lie outside the public folder and the AssetsManager is just needed to take a file from a non-public folder and publish it in a public one, what would then be the url to it. And if your module has files outside of it, then this is a strange module and the meaning of designing its logic as a module is not entirely clear. There is a suspicion that you are just too lazy to deal with assets. But it's faster than inventing crutches. Here is another moment. The module should not include js. Widget must connect js and it has tools for this. But the widget can be part of the module or its dependency.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question