im new in Angular and I'm trying to make site with list of books (with properties a,b,c,d) and where u can add new book. 1st time when i submit everythik goes fine and 2nd time i get this error v2.newBook is not a function. Does anyone knows why its working 1st time and 2nd time not? Thx
`https://plnkr.co/edit/OtfLPuQFptfgUxuo0pXJ`
https://plnkr.co/edit/3wwbDfTjcVQKx0VmsDFn?p=preview
Here is a working plnkr. You have both your function and object as newBook which is causing the problem.
$scope.newBook1 = function(book) {
book.id = $scope.books.length;
$scope.books.push(book);
resetForm();
}
HTML :
<form class="form-group" ng-show="newBookForm" ng-submit="newBook1(newBook)" novalidate>