-1
我有2个控制器,loginCtrl和regCtrl,登录控制器$ scope.login内有一个函数,我想从我的regCtrl中调用此函数。 我想要实现的是将用户重定向到他的主页,而不必在成功注册后登录。在loginCtrl如何使用angularjs中的另一个控制器中的控制器中定义的功能
$scope.login=function(){
NProgress.start();
singInClicked = true;
var request =$http({
withCredentials: true,
method:"post",
url: "http://localhost:1337/auth/login",
data: {
user_identifier: $scope.user_identifier,
password: $scope.password
}
});
and the code of the regCtrl where i want to call this function is
request.success(
function(data){
$scope.response=data;
console.log("you have registered successfully");
//serviceStatus($http);
//**call $scope.login here**
NProgress.done();
});
登录功能我如何实现这一目标?
无法在控制台中给出错误消息,说 错误:[$ injector:modulerr]无法实例化模块altonitoApp,原因是:[$ injector:modulerr]无法实例化模块altonitoApp.index-控制器,原因是: [$ injector:nomod]模块'altonitoApp.index-controllers'不可用!您拼错了模块名称或忘记加载模块名称。如果注册模块确保您指定依赖关系作为第二个参数。 – Gaurav 2014-08-29 03:45:16
这是您的应用初始化错误,您可能有一些语法错误或您的名字可能是错误的。请准备一名运动员。当你实例化一个控制器时,这个错误信息不应该出现,除非那个控制器不可用,或者不在这个应用程序不依赖的不同应用程序中。 – PSL 2014-08-29 03:47:19
@Gaurav这是一个演示例子。检查控制台和script.js。 http://plnkr.co/edit/0uKVjD?p=preview你还有其他问题。你删除了“...”我已经把我的答案放在右边? – PSL 2014-08-29 03:58:35