Skip to content

Instantly share code, notes, and snippets.

@sivaprasadreddy
Created September 5, 2014 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sivaprasadreddy/306a9c2b79ad1f6a48ec to your computer and use it in GitHub Desktop.
Save sivaprasadreddy/306a9c2b79ad1f6a48ec to your computer and use it in GitHub Desktop.
TodoController-v1.js
myApp.controller('TodoController',['$scope','$http',function($scope,$http){
var todoCtrl = this;
todoCtrl.todos = [];
todoCtrl.loadTodos = function(){
$http.get('/todos.json').success(function(data){
todoCtrl.todos = data;
}).error(function(){
alert('Error in loading Todos');
});
};
todoCtrl.loadTodos();
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment