How to add "AddItem" in AngularJS


#1

I’m new to both DreamFactory and AngularJS, so please bear with me. :slight_smile:

I’m trying to modify the todoangular example to work with my data.

I updated the get function successfully and my data is bound on the frontend.

    TodoApp.factory('Todo', function ($resource) {
    "use strict";
    return $resource('http://hargy-server:8081/rest/pb/price_book_display/?app_name=pricebook&limit=5&order=Date%20DESC', {}, { update: { method: 'PUT' }, query: {
        method: 'GET',
        isArray: false
    } });
});

But I can’t figure out how to get the addItem to work:

$scope.addItem = function(){
    $scope.todo.complete = false;
    Todo.save($scope.todo, function(data){
        $scope.Todos.record.push(data);
        $scope.todo={};
    });

I get a 500 error on “http://hargy-server:8081/rest/pb/price_book_display/?app_name=pricebook&limit=5&order=Date%20DESC” when I click the add button