AngularJS comments form
How do I make an angularjs comments form?
Via http://www.interaktionsdesigner.de/2013/03/16/ein-einstieg-in-angularjs/. What is a angularjs comments form? How do you make a angularjs comments form? This script and codes were developed by Christian Fleschhut on 11 August 2022, Thursday.
AngularJS comments form - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>AngularJS comments form</title> <link rel='stylesheet prefetch' href='http://cdn.foundation5.zurb.com/foundation.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class='row'> <div class='column'> <div ng-app='app'> <div class='comments' ng-controller='CommentsCtrl'> <form> <fieldset> <legend> Your comment </legend> <div> <label> Name: <input ng-model='name' type='text'> </label> </div> <div> <label> Comment: <textarea ng-model='text'></textarea> </label> </div> <div> <input class='button' ng-click='submit()' type='submit' value='Submit'> </div> </fieldset> </form> <h3> {{comments.length}} Comments </h3> <ul> <li ng-repeat='comment in comments'> <div class='comment' ng-class='{approved: comment.approved}'> <h5> {{comment.name}}: </h5> <div> {{comment.text}} </div> <p> <small> <a ng-click='approve(comment)' ng-hide='comment.approved'> approve comment | </a> <a ng-click='drop(comment)'> delete comment </a> </small> </p> </div> </li> </ul> </div> </div> </div>
</div> <script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
AngularJS comments form - Script Codes CSS Codes
.comment { opacity: 0.5;
}
.comment.approved { opacity: 1;
}
AngularJS comments form - Script Codes JS Codes
(function() { angular.module('app', []).controller('CommentsCtrl', function($scope) { $scope.comments = [ { name: 'asdf', text: 'hello world', approved: true }, { name: 'xyz', text: 'lorem ipsum', approved: false } ]; $scope.submit = function() { $scope.comments.push({ name: $scope.name, text: $scope.text, approved: false }); $scope.name = ''; return $scope.text = ''; }; $scope.approve = function(comment) { return comment.approved = true; }; return $scope.drop = function(comment) { return $scope.comments.splice($scope.comments.indexOf(comment), 1); }; });
}).call(this);
Developer | Christian Fleschhut |
Username | cfleschhut |
Uploaded | August 11, 2022 |
Rating | 3 |
Size | 3,280 Kb |
Views | 32,384 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Processing.js Playground | 2,392 Kb |
Frontend Dev Skillset | 2,835 Kb |
Playing with firebase | 3,175 Kb |
HubSpot Odometer Quicktest | 2,641 Kb |
CSS3 loading spinner | 2,950 Kb |
AngularJS tutorial app | 4,565 Kb |
CodeSchool Powering Up with React | 7,420 Kb |
Json data for todolist | 1,615 Kb |
Bootstrap 3 Playground | 2,594 Kb |
React-Bootstrap sandbox | 2,936 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Text Blocks Over Image, Updated | KatieK2 | 3,122 Kb |
Table border-collapse property | Maxds | 1,672 Kb |
Pink expansion tunnel | Vez | 1,738 Kb |
RRC wrapSwitch | Pshrmn | 2,922 Kb |
Random Gradients - JS | Aldlevine | 2,026 Kb |
Custom Select Element | Agrayson | 3,616 Kb |
CSS3 Butterfly | Timohausmann | 3,430 Kb |
Mondrian | Chrisarmstrong | 2,787 Kb |
LAMP PURE CSS with Animation | Dam62500 | 2,911 Kb |
Opening Reveal Modal On Document Ready | Winghouchan | 1,787 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!