私はAngularjsを使用していますが、2つの異なるjspファイルにコードを記述しました。2つの異なるビューを示しています。単一のビューをレンダリングすると正常に機能しますが、同じページに両方のビューをレンダリングすると、このエラーが発生します
Error: Argument 'UserCtrl' is not a function, got undefined
jspのjsコードスニペットは次のとおりです。
私の最初のjspファイルには
// 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");
});
そして2番目のものは
// 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");
});
モジュールに明確な名前を付けようとしましたが、それもうまくいきませんでした。助けていただければ幸いです。ありがとう !