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="widget-box" id="recent-box" ng-controller="tasksController"> | |
<div class="widget-header header-color-blue"> | |
<div class="row"> | |
<div class="col-sm-6"> | |
<h4 class="bigger lighter"> | |
<i class="glyphicon glyphicon-align-justify"></i> | |
TASK MANAGER | |
</h4> | |
</div> | |
<div class="col-sm-3"> |
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
<html ng-app="myApp"> | |
<head> | |
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/> | |
<link rel="stylesheet" type="text/css" href="css/taskman.css"/> | |
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,300,700" rel="stylesheet" type="text/css"> | |
</head> | |
<body ng-controller="tasksController"> | |
<div class="navbar navbar-default" id="navbar"> |
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
CREATE DATABASE IF NOT EXISTS angularcode_task; | |
USE angularcode_task; | |
-- | |
-- Table structure for table `tasks` | |
-- | |
CREATE TABLE IF NOT EXISTS `tasks` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`task` varchar(200) NOT NULL, |
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
<?php | |
include('../includes/config.php'); | |
$id = $_GET['id']; | |
$votes = $_GET['votes']; | |
$query="update posts set votes='$votes' where id='$id'"; | |
$result = $mysqli->query($query) or die($mysqli->error.__LINE__); | |
// $affected = $mysqli->affected_rows; | |
?> |
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
<?php | |
include('../includes/config.php'); | |
$query="select id,title,description,url,votes from posts order by id desc"; | |
$result = $mysqli->query($query) or die($mysqli->error.__LINE__); | |
$arr = array(); | |
if($result->num_rows > 0) { | |
while($row = $result->fetch_assoc()) { | |
$arr[] = $row; |
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 app = angular.module('myApp',[]); | |
app.controller('votingCtrl', function($scope, $http) { | |
$http.post('ajax/getPosts.php').success(function(data){ | |
$scope.posts = data; | |
}); | |
$scope.upVote = function(post){ | |
post.votes++; | |
updateVote(post.id,post.votes); | |
}; | |
$scope.downVote = function(post){ |
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
body{ | |
font-family: 'Open Sans', sans-serif; | |
} | |
a { | |
color: #E1704B; | |
transition: color 0.5s ease; | |
} | |
a:hover{ | |
cursor:pointer; | |
} |
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
<?php | |
$DB_HOST = '127.0.0.1'; | |
$DB_USER = 'root'; | |
$DB_PASS = ''; | |
$DB_NAME = 'angularcode_voting'; | |
$mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME); | |
?> |
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
<html ng-app="myApp"> | |
<head> | |
<link rel="stylesheet" href="css/bootstrap.min.css"> | |
<link rel="stylesheet" type="text/css" href="css/style.css"/> | |
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,300,700" rel="stylesheet" type="text/css"> | |
<title>Simple Voting System Using AngularJS</title> | |
</head> | |
<body> | |
<div class="navbar navbar-default" id="navbar"> |
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
CREATE DATABASE IF NOT EXISTS angularcode_voting; | |
USE angularcode_voting; | |
-- -------------------------------------------------------- | |
-- | |
-- Table structure for table `posts` | |
-- |