@@ -74,14 +74,15 @@ class NgView extends Widget
7474 */
7575 public static $ requireAssets = [
7676 'ui.bootstrap ' => 'dee\angular\AngularBootstrapAsset ' ,
77- 'dee ' => 'dee\angular\DeeAngularAsset ' ,
77+ 'dee.ui ' => 'dee\angular\DeeAngularUiAsset ' ,
78+ 'dee.rest ' => 'dee\angular\DeeAngularRestAsset ' ,
7879 'ngRoute ' => 'dee\angular\AngularRouteAsset ' ,
7980 'ngResource ' => 'dee\angular\AngularResourceAsset ' ,
8081 'ngAnimate ' => 'dee\angular\AngularAnimateAsset ' ,
8182 'ngAria ' => 'dee\angular\AngularAnimateAsset ' ,
8283 'ngTouch ' => 'dee\angular\AngularAnimateAsset ' ,
8384 'validation ' => 'dee\angular\AngularValidationAsset ' ,
84- 'validation.rule ' => 'dee\angular\AngularValidationAsset '
85+ 'validation.rule ' => 'dee\angular\AngularValidationAsset ' ,
8586 ];
8687 private $ _varName ;
8788
@@ -113,9 +114,9 @@ public function run()
113114 $ visible = ArrayHelper::remove ($ route , 'visible ' , true );
114115 list ($ routeProvider , $ controller , $ template ) = $ this ->applyRoute ($ route , $ path );
115116
116- if ($ path === 'otherwise ' ){
117+ if ($ path === 'otherwise ' ) {
117118 $ routeProviders [] = "\$routeProvider.otherwise( {$ routeProvider }); " ;
118- }elseif ($ visible ) {
119+ } elseif ($ visible ) {
119120 $ p = Json::htmlEncode ($ path );
120121 $ routeProviders [] = "\$routeProvider.when( {$ p }, {$ routeProvider }); " ;
121122 }
@@ -134,8 +135,13 @@ public function run()
134135 $ js [] = $ this ->renderRouteProviders ($ routeProviders );
135136 $ js [] = $ this ->renderControllers ($ controllers );
136137 $ js [] = $ this ->renderResources ();
138+ if ($ this ->js !== null ) {
139+ foreach ((array )$ this ->js as $ file ) {
140+ $ js [] = "\n" . static ::parseBlockJs ($ view ->render ($ file ));
141+ }
142+ }
137143
138- $ options = empty ($ this ->clientOptions )? '{} ' : Json::htmlEncode ($ this ->clientOptions );
144+ $ options = empty ($ this ->clientOptions ) ? '{} ' : Json::htmlEncode ($ this ->clientOptions );
139145 $ js [] = "\nreturn module; \n})( {$ options }); " ;
140146
141147 $ view ->registerJs (implode ("\n" , $ js ), WebView::POS_END );
@@ -214,10 +220,6 @@ protected function renderModule()
214220 }
215221 $ js = "var module = angular.module(' {$ this ->name }', " . Json::htmlEncode ($ requires ) . "); \n"
216222 . "var {$ this ->_varName } = module; " ;
217-
218- if ($ this ->js !== null ) {
219- $ js .= "\n" . static ::parseBlockJs ($ view ->render ($ this ->js ));
220- }
221223 return $ js ;
222224 }
223225
@@ -252,7 +254,7 @@ protected function renderControllers($controllers)
252254 $ view = $ this ->getView ();
253255 foreach ($ controllers as $ name => $ injection ) {
254256 $ injection = array_unique (array_merge (['$scope ' , '$injector ' ], (array ) $ injection ));
255- $ injectionStr = rtrim (Json::htmlEncode ($ injection ),'] ' );
257+ $ injectionStr = rtrim (Json::htmlEncode ($ injection ), '] ' );
256258 $ injectionVar = implode (", " , $ injection );
257259 $ function = implode ("\n" , ArrayHelper::getValue ($ view ->js , $ name , []));
258260 $ js [] = "module.controller(' $ name', {$ injectionStr }, \nfunction( $ injectionVar){ \n{$ function }\n}]); " ;
0 commit comments