이전에는이 문제가 없었으며 이것이 작은 문제라는 것을 알고 있지만 ... 잘못된 부분을 파악할 수 없습니다 ... 부분적으로 1 개가 올바르게로드되지 않고 대신 그렇지 않으면 다시 내/로그인 (내가 지정한)에 도달합니다. 설문 조사 만들기 링크를 클릭 할 때마다 다시 로그인으로 리디렉션되고 URL에이 http://localhost:3000/#!/login#%2Fcreate이 표시되지만 URL에 http://localhost:3000/#!/create을 입력하면 작동합니다. 문제가 무엇인지는 확실하지 않습니다. 도와주세요!각 부분이 작동하지 않음
var app = angular.module('myApp', ['ngRoute']);
app.config(function($routeProvider){
\t $routeProvider
\t .when('/login', {
\t \t templateUrl: 'partials/login.html',
\t \t controller: 'UserController'
\t })
\t .when('/dashboard', {
\t \t templateUrl: 'partials/dashboard.html',
\t \t controller: 'SurveyController'
\t })
\t .when('/create', {
\t \t templateUrl: 'partials/create.html',
\t \t controller: 'SurveyController'
\t })
\t .when('/poll/:id', {
\t \t templateUrl: 'partials/poll.html'
\t })
\t .otherwise({
\t \t redirectTo: '/login'
\t });
})
<!DOCTYPE html>
<html>
<head>
\t <title>Survey Polls</title>
\t <!-- CSS -->
\t <link rel="stylesheet" href="bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="styles.css"> \t
\t <!-- Angular -->
\t <script src="angular/angular.js"></script>
\t <script src="angular-route/angular-route.js"></script>
\t <!-- jQuery/Bootstrap -->
\t <script src="jquery/dist/jquery.js"></script>
\t <script src="bootstrap/dist/js/bootstrap.js"></script>
\t <!-- App.js -->
\t <script src="app.js"></script>
\t <!-- Controllers/Factories -->
\t <script src="controllers/SurveyController.js"></script> \t
\t <script src="controllers/UserController.js"></script>
\t <script src="factories/SurveyFactory.js"></script>
\t <script src="factories/UserFactory.js"></script>
</head>
<body ng-app="myApp">
\t <div class="container">
\t \t <div ng-view></div>
\t </div>
</body>
</html>
<a href="#/create">Create a new survey</a>
<h3>Current polls:</h3>
<table border="1">
\t <thead>
\t \t <tr>
\t \t \t <th>Name</th>
\t \t \t <th>Survey Question</th>
\t \t \t <th>Date Posted</th>
\t \t \t <th>Action</th>
\t \t </tr>
\t </thead>
\t <tbody>
\t \t <tr ng-repeat="s in surveys">
\t \t \t <td>{{ s._user.username }}</td>
\t \t \t <td>{{ s.question }}</td>
\t \t \t <td>{{ s.created_at }}</td>
\t \t \t <td><button ng-show="loggedInUser._id == s._user._id" ng-click="delete(s._id)">Delete</button></td>
\t \t </tr>
\t </tbody>
</table>
어느 것이 작동하지 않습니까? – Yaser
예, 죄송합니다. 게시물을 편집했습니다. 와우! –
은 상태를 생성하기 위해 탐색하는 방법을 보여줍니다. – Thalaivar