We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi guys,
first of all: thanks a lot for this cool package.
I am just starting out with angular and I could really use some good examples on how to use this resource.
Could somebody help me out?
For question 1) I think I have found the way to do it::
// services.js var todoServices = angular.module('todoServices', ['djangoRESTResources']) .factory('Todo', function (djResource) { return djResource('/api/todos/:todoId/', {todoId:'@id'}); } );
Right now I am stuck with question 2). How do I insert a new item? This is my current code (NOT working):
<form ng-submit="TodoListCtrl.addTodo(todo)" novalidate> <div class="form-group"> <label for="exampleInputEmail1">Description</label> <input ng-model="todo.description" id="todoDescription" type="text" class="form-control" placeholder="Todo"> </div> <div class="checkbox"> <label> <input ng-model="todo.is_done" id="todoIsDone" type="checkbox"> ist done? </label> </div> <button ng-click="add(todo)" type="submit" class="btn btn-default">submit</button> </form>
// controllers.js todoControllers.controller('TodoListCtrl', ['$scope', 'Todo', function ($scope, Todo) { $scope.todos = Todo.query(); $scope.add = function(todo) { var newTodo = new Todo({description:todo.description, is_done:todo.is_done}); newTodo.$save(); } } ]);
Any ideas how to do this?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi guys,
first of all: thanks a lot for this cool package.
I am just starting out with angular and I could really use some good examples on how to use this resource.
Could somebody help me out?
For question 1) I think I have found the way to do it::
Right now I am stuck with question 2). How do I insert a new item? This is my current code (NOT working):
Any ideas how to do this?
The text was updated successfully, but these errors were encountered: