我正在使用angularJS构建应用程序。我有一个有效的解决方案,有一个登录页面和一个注册页面,每个页面都有自己的模块和控制器文件。我重新构建了如下所示的app逻辑,将两个表单移动到我的主页。但是,注册控制器不起作用,但登录确实如此。出了什么问题?
HomepageController.js:
var login = angular.module('login', ['toastr', 'compareTo','ngMaterial']);
var signup = angular.module('signup', ['toastr', 'compareTo','ngMaterial']);
var HomepageModule = angular.module('HomepageModule', ['login', 'signup']);
login.controller('LoginController', function ($scope, $http, toastr) {
$scope.loginForm = {
loading: false
}
$scope.submitLoginForm = function (){
};
});
signup.controller('SignupController', function ($scope, $http, toastr) {
$scope.signupForm = {
loading: false
}
$scope.submitSignupForm = function(){
console.log("Create Account Pressed");
};
});
homepage.ejs:
<body ng-app="HomepageModule" ng-cloak>
<span ng-controller="LoginController">
<form ng-submit="submitLoginForm()">
<!-- Variuos inputs etc.-->
</form>
</span>
<span ng-controller="SignupController">
<form ng-submit="submitSignupForm()" id="sign-up-form" class="form-signin" name="signup"></form>
</span>
</body>