Skip to content

Instantly share code, notes, and snippets.

:octocat:

K. Siva Prasad Reddy sivaprasadreddy

:octocat:
Block or report user

Report or block sivaprasadreddy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View service-service.js
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) {
View factory-service.js
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) {
View 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');
});
};
View hello-ang-controller.js
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;
View hello-ang-home.html
<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">&nbsp;
</div>
<button class="btn btn-primary" ng-click="addTodo(newTodo)">Add</button>
</div>
</form>
View hello-ang-final-index.html
<!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"/>
View hello-ang-app.js
var myApp = angular.module('myApp',['ngRoute']);
myApp.config(['$routeProvider','$locationProvider',
function($routeProvider, $locationProvider) {
$routeProvider
.when('/home', {
templateUrl: 'templates/home.html',
controller: 'TodoController'
})
@sivaprasadreddy
sivaprasadreddy / HelloAng-DatabasePopulator.java
Created Sep 4, 2014
HelloAngular DatabasePopulator.java
View HelloAng-DatabasePopulator.java
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;
@sivaprasadreddy
sivaprasadreddy / Entity-Repo-Ctrl.java
Created Sep 4, 2014
Todo Entity-Repo-Ctrl.java classes
View Entity-Repo-Ctrl.java
package com.sivalabs.app.entities;
@Entity
public class Todo {
@Id @GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
private String description;
@Temporal(TemporalType.TIMESTAMP)
private Date createdOn = new Date();
//setters and getters
@sivaprasadreddy
sivaprasadreddy / HelloAngular-Application.java
Created Sep 4, 2014
Hello AngularJS Application.java
View HelloAngular-Application.java
package com.sivalabs.app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Configuration
You can’t perform that action at this time.