TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ejaz mirza
NA
471
46.9k
dynamic text boxes along with check boxes
Mar 28 2019 1:54 AM
am adding dynamic text boxes here now i want to add list of check boxes which are dynamically loaded in array how should i add those checkboxes to the beside that textboxes when i click new add row textboxes along with checkboxes i want
<
html
>
<
head
>
<
title
>
</
title
>
</
head
>
<
body
>
<
script
type
=
"text/javascript"
src
=
"https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"
>
</
script
>
<
script
type
=
"text/javascript"
>
var
app
=
angular
.module('MyApp', [])
app.controller('MyController', function ($scope, $window) {
$
scope.Customers
= [];
$
scope.Add
=
function
() {
//Add the new item to the Array.
var
customer
= {};
customer.Name
= $scope.Name;
customer.Country
= $scope.Country;
$scope.Customers.push(customer);
//Clear the TextBoxes.
$
scope.Name
=
""
;
$
scope.Country
=
""
;
};
$
scope.Remove
=
function
(index) {
//Find the record using Index from Array.
var
name
= $scope.Customers[index].Name;
if ($window.confirm("Do you want to delete: " + name)) {
//Remove the item from Array using Index.
$scope.Customers.splice(index, 1);
}
}
});
</
script
>
<
div
ng-app
=
"MyApp"
ng-controller
=
"MyController"
>
<
table
cellpadding
=
"0"
cellspacing
=
"0"
>
<
tr
>
<
th
>
Name
</
th
>
<
th
>
Country
</
th
>
<
th
>
</
th
>
</
tr
>
<
tfoot
>
<
tr
>
<
td
>
<
input
type
=
"text"
ng-model
=
"Name"
/>
</
td
>
<
td
>
<
input
type
=
"text"
ng-model
=
"Country"
/>
</
td
>
<
td
>
<
input
type
=
"button"
ng-click
=
"Add()"
value
=
"Add"
/>
</
td
>
</
tr
>
</
tfoot
>
<
tbody
ng-repeat
=
"m in Customers"
>
<
tr
>
<
td
>
<
input
type
=
"text"
value
=
"{{m.Name}}"
/>
</
td
>
<
td
>
<
input
type
=
"text"
value
=
"{{m.Country}}"
/>
</
td
>
<
td
>
<
input
type
=
"button"
ng-click
=
"Remove($index)"
value
=
"Remove"
/>
</
td
>
</
tr
>
</
tbody
>
</
table
>
</
div
>
</
body
>
</
html
>
Reply
Answers (
1
)
how to cover code in unit testing for DOM
angular 6 material datetimepicker issue