我正在使用角js,我写了两个不同的jsp files.showing两个不同的意见代码。 如果我渲染它的工作原理fine.but如果我呈现同一页上都看法我得到这个错误Angular js没有找到控制器?
单一视图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");
});
,并在第二个是
// 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");
});
我试图给模块不同的名称,但同样没有工作了me.any帮助表示赞赏。 谢谢!
感谢您的回复,但问题是别的,在我的回答中描述了它。 –
谢谢你。我在两个单独的文件中对应用程序进行了双重实例化。 – Trip