Last Updated: February 25, 2016
·
4.629K
· adelevie

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

4 Responses
Add your response

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

http://brandid.github.io/parse-angular-demo

over 1 year ago ·

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

over 1 year ago ·

Hey dude, sure I'll check out your work.

Arush

over 1 year ago ·

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.

over 1 year ago ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

AngularJS pages are long-lived browser apps with the same script risk as a newer single-page app. Third-party code in the template can read forms and values rendered on the page.

Security insights from Cside