0
我想創建一個簡單的單頁面應用程序在使用Django + Django Rest Framework + Angularjs。成功登錄/密碼錶單後,我應該重定向到帶有聯繫人列表的頁面,在那裏我可以添加或刪除。對於我的後臺,我將使用教程從這裏http://www.django-rest-framework.org/tutorial/quickstart/,和簡單的登錄/密碼頁面看起來就像這樣單頁面應用程序Angularjs Django登錄表單
<html ng-app="myApp">
<head>
<title></title>
</head>
<body ng-controller="AppController as ctrl">
<form ng-submit="ctrl.submit()">
<input type="text" ng-model="ctrl.user.username" placeholder="Enter your name"/><br/><br/>
<input type="text" ng-model="ctrl.user.password" placeholder="Enter your Password"/><br/><br/>
<input type="submit" value="Submit">
</form>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js">
</script>
<script>
angular.module('myApp', [])
.controller('AppController', [function() {
var self = this;
self.submit = function() {
console.log('Form is submitted with following user', self.user);
};
}]);
</script>
</body>
</html>
而且我不明白我怎麼可以從前置式提交登錄/密碼的形式端到端的應用程序的後端?