Whenever I attempt to create a new task, nothing seems to happen and no request is being sent. What could be causing this issue? How can I go about troubleshooting it?
Take a look at how it appears here
Check out the $scope.add function below:
var app = angular.module('Tasks', ['ngResource', 'xeditable']);
app.factory('Task', [
'$resource', function($resource) {
return $resource('/tasks/:id', {
id: '@id'
}, {
update: {
method: 'PUT'
}
});
}
]);
this.TasksCtrl = [
'$scope', 'Task', function($scope, Task) {
$scope.add = function() {
var task;
task = Task.create($scope.newTask);
$scope.tasks.push(task);
return $scope.newTask = {};
};
];
Below is my html code snippet:
<div ng-controller='TasksCtrl' class='tasks-container'>
<form ng-submit='add()'>
<input type='text' ng-model='newTask.title'/>
<button type='button' class='btn btn-default btn-sm'>
<span class='glyphicon glyphicon-plus'></span> Add
</button>
</form>