I am using angular js, I wrote the code in two different jsp files. Featuring two different views. if I create a separate view, it works fine.but, if I render both views on the same page, I got this error
Error: Argument 'UserCtrl' is not a function, got undefined
The js code snippet in jsp is as follows.
in my first jsp file there is
// Bootstrap the Application var App = angular.module('module', []); // Set up a controller and define a model App.controller('UserCtrl', function($scope) { $scope.user = {}; jQuery.get("<c:url value='${someUrl}'/>", function(data) { angular.element('#user_detail').scope().user = data; angular.element('#user_detail').scope().$apply(); }, "json"); });
and in the second -
// Bootstrap the Application var App = angular.module('module', []); // Set up a controller and define a model App.controller('ProfileCtrl', function($scope) { $scope.profile = {}; jQuery.get("<c:url value='${someUrl}'/>", function(data) { angular.element('#profile').scope().profile = data; angular.element('#profile').scope().$apply(); }, "json"); });
I tried to give different names to the modules, but that didn't work for me either. Any help is appreciated. thanks!
source share