If you have reached this blog post then count yourself lucky. It took me hours of debugging to figure out the source of this error. The error information given by Angular is also not very useful. So let’s get to the two possible sources of this error and their possible solutions. The first possible source is that you are calling your function addTable. This seems to be a reserved function name even though I was not able to find any information regarding it on the Angular docs. The solution for this problem, although hard to find, is actually quite simple to implement. Just rename the function to something else. A simple new function name that works would be addNewTable. Here are two examples of the same piece of code. The first example does not work due to the addTable naming of the function.
<button class="controls" ng-click="addTable()">Add Table</button> //does not works <button class="controls" ng-click="addNewTable()">Add Table</button> //works
The second possible source of this problem is that you are probably calling this function via ngSubmit instead of ngClick. When you call ngSubmit Angular prevents the default action of submitting data to the server, but it still expects data to be submitted. If you do not run a function which is submitting data it will give you the before mentioned error. The solution to this problem is to simply swap ngClick for ngSubmit and to replace your submit button with a regular button. Here are two examples of the same click - the first one does not work due to ngSubmit while the second one works.
<button class="controls" ng-click="addNewTable()">Add Table</button> //does not work <submit class="controls" ng-submit="addNewTable()" value="Add Table"> //works