Organizational Research By

Surprising Reserch Topic

send the id from the table to the controller with angularjs


send the id from the table to the controller with angularjs  using -''

I wonder how can I send the id of the selected row from my table to the controller when I try to show the details of these row,this is my code:



.controller("etudmodifCtrl", ["$scope", "$http", "filterFilter", "$rootScope", "logger", "$filter", "$modal", "$log", function ($scope, $http, filterFilter, $rootScope, logger, $filter, $modal, $log) {
                           
                         
                            $http({method: 'GET', url: 'http://localhost:50001/api/Students/'+$scope.store.id})

                                    .success(function (data) {
                                      
                                       $scope.firstname=data.FirstName;
                                       $scope.lastname=data.LastName;
                                       $scope.email=data.Email;
                                        console.log("success");


                                    }).error(function (data, status, headers, config) {

                                console.log("data error ...");
                            });
  
                $scope.open = function () {
                                var modalInstance;
                                modalInstance = $modal.open({
                                    templateUrl: "myModalContent1.html",
                                    controller: "ModalInstanceCtrl",
                                    resolve: {
                                        items: function () {
                                            return $scope.items
                                        }
                                    }
                                }), modalInstance.result.then(function (selectedItem) {
                                    $scope.selected = selectedItem
                                }, function () {
                                    $log.info("Modal dismissed at: " + new Date)
                                })
                            }
                
                }])
<table class="table table-responsive table-hover">
  <tr ng-repeat="store in currentPageStores">    
                                <td align="center">{{store.LastName}}</td>
                                <td align="center">{{store.FirstName}}</td>
                                <td align="center">{{store.Email}}</td>
                                <td align="center">{{store.Class}}</td>
                                <td align="center">
                                    <script type="text/ng-template" id="myModalContent.html">
                                     <div class="modal-header">
                                        <h3 style="text-align:center;">Modify Informations</h3>
                                        </div>
                                        <div class="modal-body modal-dialog modal-lg3" data-ng-controller="etudmodifCtrl">
                                        <section class="form-horizontal page-form-ele page" >
                                        <section class="panel panel-default">
                                        <div class="panel-heading"><center><strong>Renseignements Personnels</strong></center></div>
                                        <div class="panel-body" >
                                           <div class="col-md-6">
                                                 <div class="form-group">
                                        <label for="" class="col-sm-2">FirstName</label>
                                        <div class="col-sm-10">
                                        <input type="email" class="form-control" style="
                                        border-radius: 20px;
                                        width: 206px;
                                        " placeholder="" ng-model="firstname">
                                        </div>
                                        </div>
                                           </div>
                                            <div class="col-md-6">
                                                 <div class="form-group">
                                        <label for="" class="col-sm-2">LastName</label>
                                        <div class="col-sm-10">
                                        <input type="email" class="form-control" style="
                                        border-radius: 20px;
                                        width: 206px;
                                        " placeholder="" ng-model="lastname">
                                        </div>
                                        </div>
                                           </div>
                                          <div class="col-md-6">
                                        <div class="form-group">
                                        <label for="" class="col-sm-2">Email</label>
                                        <div class="col-sm-10">
                                        <input type="email" class="form-control" style="
                                        border-radius: 20px;
                                        width: 206px;
                                        " placeholder="" ng-model="email">
                                        </div>
                                        </div>
                                        </div>
 
                                        </div></script>
                                  </td></tr>
</table>
<button type="button" onclick="window.location = '" aria-label="Center Align" ng-click="open()" data-toggle="modal" data-target=".bs-example-modal-lg">Modify</button>

asked Oct 13, 2015 by deven.bendale
0 votes
0 views



Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

...