각도 ngResource에 문제가 있습니다. 나는 코드의 첫 번째 부분의 주석을 해제 할 때ngResource 및 SPA angularjs가 표시되지 않습니다.
/*var app = angular.module('myApp', ['ngResource']);
app.factory('todoFactory', function($resource) {
return $resource('/api/meetups');
});*/
angular.module('myApp').controller('loginController',
['$scope', '$location', 'AuthService',
function ($scope, $location, AuthService) {
$scope.login = function() {
// initial values
$scope.error = false;
$scope.disabled = true;
// call login from service
AuthService.login($scope.loginForm.username, $scope.loginForm.password)
// handle success
.then(function() {
$location.path('/');
$scope.disabled = false;
$scope.loginForm = {};
})
// handle error
.catch(function() {
$scope.error = true;
$scope.errorMessage = "Invalid username and/or password";
$scope.disabled = false;
$scope.loginForm = {};
});
};
}]);
angular.module('myApp').controller('logoutController',
['$scope', '$location', 'AuthService', '$resource',
function ($scope, $location, AuthService) {
$scope.logout = function() {
// call logout from service
AuthService.logout()
.then(function() {
$location.path('/login');
});
};
/*
$scope.posts = [];
$scope.newPost = {created_by: '', text: '', create_at: ''};
$scope.afficher = function(){
$scope.newPost.created_at = Date.now();
$scope.posts.push($scope.newPost);
$scope.newPost = {created_by: '', text: '', created_at: ''};
};
*/
$scope.meetups = [];
/*var Meetup = $resource('/api/meetups');
Meetup.query(function (results) {
$scope.meetups = results;
});
$scope.meetups = []
$scope.createMeetup = function() {
var meetup = new Meetup();
meetup.name = $scope.meetupName;
meetup.$save(function (result) {
$scope.meetups.push(result);
$scope.meetupName = '';
});
}*/
}]);
angular.module('myApp').controller('registerController',
['$scope', '$location', 'AuthService',
function ($scope, $location, AuthService) {
$scope.register = function() {
// initial values
$scope.error = false;
$scope.disabled = true;
// call register from service
AuthService.register($scope.registerForm.username, $scope.registerForm.password)
// handle success
.then(function() {
$location.path('/login');
$scope.disabled = false;
$scope.registerForm = {};
})
// handle error
.catch(function() {
$scope.error = true;
$scope.errorMessage = "Something went wrong!";
$scope.disabled = false;
$scope.registerForm = {};
});
};
}]);
문제가 발생합니다 : 나는 페이지가 채워지지 않습니다 종속성을 추가 할 때 .. 여기 내 코드입니다. 나는 정말로 붙어있는 제안이나 정보를 받아 들여서 나를 도와주세요. 나는 필요시 코드를 추가 할 것이다.
답장을 위해 10x 스크립트 참조를 추가했습니다. 나는 아무것도 표시하지 않는 첫 번째 부분의 주석을 제거하고 콘솔에 오류가 표시되지 않습니다. 제발 도와주세요. –