blacklocus/angular-django-rest-resource
소개
An AngularJS module that provides a resource-generation service similar to ngResource, but optimized for the Django REST Framework.
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalangular-django-rest-resource
An AngularJS module that provides a resource-generation service similar to ngResource, but optimized for the Django REST Framework. The biggest features:
- Trailing slashes allowed in the resource URLs per the Django community norm.
- The
isArraymethods likequeryallow for paginated responses. The pages will be streamed into the promise object.
Installation
Download angular-django-rest-resource.js and put it in your project. You may also do it the bower way:
bower install angular-django-rest-resource
Usage
Do this somewhere in your application HTML:
<script src="angular-django-rest-resource.js"></script>
Add this AngularJS module as a dependency to your AngularJS application:
angular.module('app', [..., 'djangoRESTResources']);
(where 'app' is whatever you've named your AngularJS application).
In your controllers and anything that needs to interact with the Django REST Framework services, inject the djResource
service. Then you can create class-like objects that represent (and interact with) your Django REST Framework resources:
var Poll = djResource('/polls/:pollId/', {pollId:'@id'});
var myPoll = Poll.get({pollId:86}, function() {
myPoll.readByUser = true;
myPoll.$save();
});
For complete API, consider the documentation for $resource, as this module follows the API quite closely.
Launching The Testing and Demonstration App
This is a work in progress, but it gives some hints on usage in a real world scenario.
Create a Python virtualenv.
Install the dependencies:
cd test pip install -r requirements.txtSet up the database and fixtures (if first time use).
python manage.py syncdbRun the server:
python manage.py runserverPoint web browser to
http://localhost:8000/.
관련 프로젝트 살펴보기
불러오는 중…