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>Nameth>
- <th>Countryth>
- <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>
Laxmidhar SahooPosted Mar 29, 2019, 12:41 AM