Parse + AngularJS
$scope.addTodo = function() {
var todo = new Todo();
todo.save({
text: $scope.todoText,
done: false
}, {
success: function(todoAgain) {
// use $scope.$apply inside of non-Angular functions
// in order to notify the DOM that the data has changed
$scope.$apply(function() {
$scope.todos.push({text: todoAgain.get("text"), done: todoAgain.get("done"), parseObject: todoAgain});
$scope.todoText = "";
});
},
error: function(error) {
alert("Error: " + error.code + " " + error.message);
}
});
};
Full example: https://github.com/adelevie/ParseAngularJS
Written by Alan deLevie
Related protips
4 Responses
Hey Alan,
This is interesting. Have you seen our Parse x AngularJS boilerplate? We built up a bunch of best practices around this stack whilst building https://www.getbrandid.com - you may want to check it out
Hi Arush,
I have come across your demo repo quite a few times. I've also been working a lot since on a full-featured Angular + Parse app. I think your repo has some excellent, excellent work, but it's been a little bit difficult to apply to the knowledge you've developed into my own projects. I'd be happy to collaborate and maybe work on a repo of libraries/best practices for working with Angular + Parse. This might be a decent start: https://github.com/adelevie/ParseAngularGuide.
-Alan
Hey dude, sure I'll check out your work.
Arush
Alan, Thanks for working on the guide, and Arush thank you for sharing the boilerplate and the included techniques. Your projects have been helping me make the transition from web page developer to web app developer.