How can I connect the script after connecting all the scripts (specifically jQuery is interested) tried this way.

$this->registerJsFile(Yii::getAlias('@backendWebroot').'/js/morris.min.js',['position' => yii\web\View::POS_READY]); 

It does not appear at all, the exact same situation is through POS_LOAD. if so as you know immediately after the tag

 $this->registerJsFile(Yii::getAlias('@backendWebroot').'/js/morris.min.js',['position' => yii\web\View::POS_END]); 
  • As I understand you need to connect morris.min.js at the very end? After all the scripts? - Urmuz Tagizade
  • Yes, you understood correctly - Sergalas
  • sorry that it's late :) I left my head and then forgot to return to the question :) - Urmuz Tagizade

1 answer 1

If you want to connect the above script after Jquery , then like this:

 $this->registerJsFile(Yii::getAlias('@backendWebroot').'/js/morris.min.js', ['yii\web\JqueryAsset']); 

If you connect scripts via AssetBundle , then you will need to specify an array of dependencies.

For example:

 <? namespace app\assets; use yii\web\AssetBundle; class TestAsset extends AssetBundle { public $baseUrl = '@web'; public $js = [ 'js/morris.min.js' ]; public $depends = [ 'yii\web\JqueryAsset', ]; }