Skip to content

Instantly share code, notes, and snippets.

View itswadesh's full-sized avatar

Swadesh Behera itswadesh

View GitHub Profile
<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>&nbsp;
TASK MANAGER
</h4>
</div>
<div class="col-sm-3">
<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">
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,
<?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;
?>
<?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;
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){
body{
font-family: 'Open Sans', sans-serif;
}
a {
color: #E1704B;
transition: color 0.5s ease;
}
a:hover{
cursor:pointer;
}
<?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);
?>
<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">
CREATE DATABASE IF NOT EXISTS angularcode_voting;
USE angularcode_voting;
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--