angular.module('CalendarTest')
.config(function($routeProvider){
$routeProvider.when('/signup', {
templateUrl: '/signup.html'
})
$routeProvider.when('/login', {
templateUrl: '/login.html'
})
$routeProvider.when('/testPage', {
templateUrl: '/testPage.html'
})
$routeProvider.when('/visitform', {
templateUrl: '/visitform.html'
})
});
路由器在索引加载时加载错误。
angular.module('formLoginApp', ['ngCookies'])
.controller('formLoginController', ['$scope', '$cookies', ($scope, $cookies) => {
$scope.email = '';
$scope.password = '';
$scope.update = (user) => {
const req = new XMLHttpRequest();
req.open('POST', 'http://localhost:4002/login', true);
req.onload = (serverResponse) => {
if (req.readyState === 4) {
if (req.status === 200) {
$cookies.put("user", req.response);
} else {
console.log('no response');
}
} else {
console.log('no response');
}
};
req.setRequestHeader("Authorization", "Negotiate");
req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
req.send(JSON.stringify(user));
};
}]);
当我尝试访问此页面login.html时,我得到formLoginController不是一个(这里没什么......)。我不确定为什么会这样。我尝试简化问题并从文档添加控制器,但也破坏了。我该如何解决这个问题?