zsombro
Anime Poster Designer
LEVEL 1
300 XP
In this tutorial we will create Limit Table Row using AngularJS. AngularJS is a structural framework for dynamic web apps. It is a kind of template that extends HTML to a new level of coding techniques. It is mostly used by other well known site for creating a template. So let's get started. So Let's do the coding...
Getting started:
First you will need to download & install the AngularJS here's the link https://angularjs.org/.
And download & install XAMPP or any local server that run PHP scripts. Here's the link for XAMPP server https://www.apachefriends.org/index.html.
Creating the Main Interface
This code contains the interface of the application. This code will render application and display the form. To do that just kindly write these block of code inside the text editor and save it as index.html.
Creating the Script
This code contains the main function of the application. This code will limit the display of row base on the value of input textbox. To that just kindly copy and write these block of codes inside the text editor, then save it as script.js.
There you have it we successfully created a Limit Table Row using AngularJS. I hope that this very simple tutorial help you to what you are looking for. For more updates and tutorials just kindly visit this site. Enjoy Coding!!
Download
Getting started:
First you will need to download & install the AngularJS here's the link https://angularjs.org/.
And download & install XAMPP or any local server that run PHP scripts. Here's the link for XAMPP server https://www.apachefriends.org/index.html.
Creating the Main Interface
This code contains the interface of the application. This code will render application and display the form. To do that just kindly write these block of code inside the text editor and save it as index.html.
- <!DOCTYPE html>
- <html
lang
=
"en"
>
- <head
>
- <meta
charset
=
"UTF-8"
name
=
"viewport"
content
=
"width=device-width, initial-scale=1"
/
>
- <link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"css/bootstrap.css"
/
>
- </
head
>
- <body
ng-app=
"myModule"
>
- <nav class
=
"navbar navbar-default"
>
- <div
class
=
"navbar-brand"
>
- <a
class
=
"navbar-brand"
href
=
"https://sourcecodester.com"
>
Sourcecodester</
a
>
- </
div
>
- </
nav>
- <div
class
=
"col-md-3"
></
div
>
- <div
class
=
"col-md-6 well"
>
- <h3
class
=
"text-primary"
>
JavaScript - Limit Table Row Using AngularJS</
h3
>
- <hr
style
=
"border-top:1px dotted #ccc;"
/
>
- <div
ng-controller=
"myController"
>
- <div
class
=
"form-inline"
>
- <label
>
Rows</
label
><input
type
=
"number"
class
=
"form-control"
ng-model=
"limitRow"
/
>
- </
div
>
- <br
/
>
- <table
class
=
"table table-bordered"
>
- <thead
class
=
"alert-info"
>
- <tr
>
- <th
>
Firstname</
th
>
- <th
>
Lastname</
th
>
- <th
>
Address</
th
>
- </
tr
>
- </
thead
>
- <tbody
>
- <tr
ng-repeat=
"student in students | orderBy: 'lastname' | limitTo:limitRow"
>
- <td
>
{{ student.firstname }}</
td
>
- <td
>
{{ student.lastname }}</
td
>
- <td
>
{{ student.address }}</
td
>
- </
tr
>
- </
tbody
>
- </
table
>
- </
div
>
- </
div
>
- </
body
>
- <script
src
=
"js/angular.js"
></
script
>
- <script
src
=
"js/script.js"
></
script
>
- </
html
>
Creating the Script
This code contains the main function of the application. This code will limit the display of row base on the value of input textbox. To that just kindly copy and write these block of codes inside the text editor, then save it as script.js.
- var
app =
angular
- .module
(
"myModule"
,
[
]
)
- .controller
(
"myController"
,
function
(
$scope)
{
- var
students =
[
- {
firstname:
"Ben"
,
lastname:
"Tennyson"
,
address:
"Canada"
}
,
- {
firstname:
"Erika"
,
lastname:
"Barns"
,
address:
"Germany"
}
,
- {
firstname:
"Cassie"
,
lastname:
"Lang"
,
address:
"New York"
}
,
- {
firstname:
"Alex"
,
lastname:
"Wilder"
,
address:
"Tokyo"
}
,
- {
firstname:
"Nico"
,
lastname:
"Minoru"
,
address:
"Japan"
}
,
- {
firstname:
"Ash"
,
lastname:
"Ketchump"
,
address:
"Pallet"
}
,
- {
firstname:
"Bruce"
,
lastname:
"Banner"
,
address:
"USA"
}
- ]
;
- $scope.students
=
students;
- $scope.limitRow
=
students.length
;
- }
)
;
There you have it we successfully created a Limit Table Row using AngularJS. I hope that this very simple tutorial help you to what you are looking for. For more updates and tutorials just kindly visit this site. Enjoy Coding!!
Download
You must upgrade your account or reply in the thread to view the hidden content.