javascript - AngularJS(ui-router) and dynamically linked scripts -


i have 1 problem. use angularjs ui-router. so.... write states dynamically named controllers:

.config(function ($stateprovider, $urlrouterprovider) {      function geturl ($stateparams){         return "module/" + $stateparams.path;     }      function getctrl ($stateparams){         var url = $stateparams.path.split("/");         alert(url [url.length - 1] + "ctrl");         return url [url.length - 1] + "ctrl";     }     $urlrouterprovider.when('' , '/#');      $stateprovider.state('home', {         url : "/",         views : {             '' : {                 templateurl : '/resources/template/indextemplate.html'             }         }     }).state('modules',{         url : '/{path:.*}',         views : {             '' : {                 templateurl : geturl,                 controllerprovider : getctrl             }         }     });   }); 

i have 1 simple controller in file user.js

model.controller("userctrl" , function ($scope) {$scope.user = "fsdfdg";}); 

if simple include file in index.html work great<script src="user.js"></script>. location scripts file server http request $http.get("/scripts").success(function(data){ $scope.scripts = data; });

and when generate including script <script ng-repeat="script in scripts" ng-src="{{script}}"></script> usercontroller not work more. helping)


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -