todoList
simple todo list
by var Enigmatic
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>What Can We Do Today?</title>
<link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
<link href='styles/main.css' rel='stylesheet' type="text/css">
</head>
<body ng-app="todoListApp">
<h1 ng-click="helloWorld()" class="header">What Can We Do Today?</h1>
<div ng-controller="mainCtrl" class="list">
<div class="item" ng-class="{'editing-item': editing, 'edited': todo.edited}" ng-repeat="todo in todos">
<input ng-model="todo.completed" type="checkbox"/>
<label ng-hide="editing" class="editing-label" ng-click="helloWorld()">{{todo.name}}</label>
<input ng-change="todo.editing = true" ng-blur="editing = false" ng-show="editing" ng-model="todo.name" class="editing-label" type="text"/>
<div class="actions">
<a href="" ng-click="editing = !editing">Edit</a>
<a href="" ng-click="helloConsole()">Save</a>
<a href="" class="Delete">Delete</a>
</div>
</div>
</div>
<script src="vendor/angular.js" type="text/javascript"></script>
<script src="scripts/app.js" type="text/javascript"></script>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
</html>
JavaScript
angular.module("todoListApp", [])
.controller('mainCtrl', function($scope, dataService) {
$scope.helloConsole = dataService.helloConsole;
$scope.ngChange = function() {
console.log("This is ng-change for Angular");
};
$scope.helloConsole = dataService.helloConsole;
$scope.todos = dataService.getTodos;
})
.service('dataService', function($http) {
this.helloConsole = function() {
console.log('This is a test for services!');
};
this.getTodos = function() {
return $http.get('mock/todos.json')
.then(function(response){
console.log(response.data);
return response.data;
})
};