Sample AngularJS app using controller
How do I make an sample angularjs app using controller?
What is a sample angularjs app using controller? How do you make a sample angularjs app using controller? This script and codes were developed by Victor Yan on 05 January 2023, Thursday.
Sample AngularJS app using controller - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Sample AngularJS app using controller</title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'>
</head>
<body> <html ng-app>
<body ng-controller="ctrl"> <div class="container"> <h2>Sample AngularJS app using controller <h3>{{rows.length}} Friend{{plural(rows)}} <span ng-show="temp">?<small class="muted"><em > (only {{rows.length-1}} actually....)</em></small></span></h3> <form class="form-horizontal"> <span ng-class="{'input-append':addName}"> <input id="add" type="text" placeholder="Another one ?" ng-model="addName" ng-change="addTemp()"/> <input type="submit" class="btn btn-primary" ng-click="addRow()" ng-show="addName" value="+ add"/> </span> <span class="search input-prepend" ng-class="{'input-append':search}"> <span class="add-on"><i class="icon-search"></i></span> <input type="text" class="span2" placeholder="Search" ng-model="search"> <button type="submit" class="btn btn-inverse" ng-click="search=''" ng-show="search" value="+ add">Clear</button>
</span> </form> <table class="table table-striped"> <tr ng-repeat="row in rows | filter : search" ng-class="{'muted':isTemp($index)}"> <td>{{$index+1}}</td> <td>{{row}}</td> <td> <button class="btn btn-danger btn-mini" ng-click="deleteRow(row)" ng-hide="isTemp($index)">Delete</button> </td> </tr> </table> <div style="margin-top: 20px;">Provided by <a onclick="window.open('https://www.tipsoftheday.com.au')">Tips of the day</a></div> </div>
</body>
</html> <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.2.29/angular.min.js'></script>
<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Sample AngularJS app using controller - Script Codes JS Codes
function ctrl($scope){ $scope.rows = ['Paul','John','Lucie']; $scope.temp = false; $scope.addRow = function(){ $scope.temp = false; $scope.addName=""; }; $scope.deleteRow = function(row){ $scope.rows.splice($scope.rows.indexOf(row),1); }; $scope.plural = function (tab){ return tab.length > 1 ? 's': ''; }; $scope.addTemp = function(){ if($scope.temp) $scope.rows.pop(); else if($scope.addName) $scope.temp = true; if($scope.addName) $scope.rows.push($scope.addName); else $scope.temp = false; }; $scope.isTemp = function(i){ return i==$scope.rows.length-1 && $scope.temp; };
}
Developer | Victor Yan |
Username | tipsoftheday |
Uploaded | January 05, 2023 |
Rating | 3 |
Size | 2,294 Kb |
Views | 8,096 |
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 |
Disable And Enable Input Elements In A Div Block Using jQuery | 2,033 Kb |
Make element focusable using tabindex | 1,593 Kb |
Using Javascript to calculate age | 2,538 Kb |
Bootstrap 3 navbar | 1,832 Kb |
TodoMVC using AngularJS | 6,551 Kb |
HTML 5 Canvas Example | 2,026 Kb |
HTML 5 Session Storage Example | 1,825 Kb |
Detect Enter Key Pressed Using jQuery event | 1,822 Kb |
QUnit example to verify calculate age function | 2,692 Kb |
Create inline help tips for your site with a bit of CSS | 2,229 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 |
Animated Slide Hamburger Mobile Menu | BJack | 2,247 Kb |
JavaScript Animation | Rcmeisty | 4,581 Kb |
Testing Portfolio Page | Sideshowli | 3,395 Kb |
Ghost | Mghayour | 11,738 Kb |
Image grid with captions | Mchernin34 | 2,222 Kb |
RRC wrapSwitch | Pshrmn | 2,922 Kb |
Image Stack Test SCSS | CalvinMorett | 2,799 Kb |
CSS 3D Radio buttons | Andreasnylin | 1,650 Kb |
Simple, flat contact form | Zeaklous | 2,719 Kb |
Responsive slide | Thorien | 2,400 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!