This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myApp = angular.module('myApp'); | |
myApp.factory('TodoService', function($http){ | |
return { | |
loadTodos : function(){ | |
return $http.get('todos'); | |
}, | |
createTodo: function(todo){ | |
return $http.post('todos',todo); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('myApp') | |
.provider('UserService', function() { | |
return { | |
this.$get = function($http) { | |
var service = this; | |
this.user = {}; | |
this.login = function(email, pwd) { | |
$http.get('/auth',{ username: email, password: pwd}).success(function(data){ | |
service.user = data; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('myApp') | |
.service('UserService', ['$http',function($http) { | |
var service = this; | |
this.user = {}; | |
this.login = function(email, pwd) { | |
$http.get('/auth',{ username: email, password: pwd}).success(function(data){ | |
service.user = data; | |
}); | |
}; | |
this.register = function(newuser) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('myApp') | |
.factory('UserService', ['$http',function($http) { | |
var service = { | |
user: {}, | |
login: function(email, pwd) { | |
$http.get('/auth',{ username: email, password: pwd}).success(function(data){ | |
service.user = data; | |
}); | |
}, | |
register: function(newuser) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('myApp') | |
.controller('TodoController', [ '$scope', '$http', function ($scope, $http) { | |
$scope.newTodo = {}; | |
$scope.loadTodos = function(){ | |
$http.get('todos') | |
.success(function(data, status, headers, config) { | |
$scope.todos = data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="col-md-8 col-md-offset-2"> | |
<form class="form-horizontal" role="form"> | |
<div class="form-group form-group-md"> | |
<div class="col-md-10"> | |
<input type="text" class="form-control" ng-model="newTodo.description"> | |
</div> | |
<button class="btn btn-primary" ng-click="addTodo(newTodo)">Add</button> | |
</div> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html ng-app="myApp"> | |
<head> | |
<meta charset="utf-8"/> | |
<title>DashBoard</title> | |
<link rel="stylesheet" href="webjars/bootstrap/3.2.0/css/bootstrap.css"/> | |
<link rel="stylesheet" href="webjars/font-awesome/4.1.0/css/font-awesome.css"/> | |
<link rel="stylesheet" href="css/styles.css"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myApp = angular.module('myApp',['ngRoute']); | |
myApp.config(['$routeProvider','$locationProvider', | |
function($routeProvider, $locationProvider) { | |
$routeProvider | |
.when('/home', { | |
templateUrl: 'templates/home.html', | |
controller: 'TodoController' | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sivalabs.app; | |
import java.util.Arrays; | |
import java.util.Date; | |
import javax.annotation.PostConstruct; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.stereotype.Component; | |
import com.sivalabs.app.entities.Todo; | |
import com.sivalabs.app.repos.TodoRepository; |