I have ng-repeat , and I'm trying to add a modal that passes the same scope variable to the modal window. I can get a modal window to open, but the value of the area from ng-repeat does not appear inside the modal. Hope my code explains better. This is what I have so far:
<div ng-controller="CustomerController"> <div ng-repeat="customer in customers"> <button class="btn btn-default" ng-click="open()">{{ customer.name }}</button> <script type="text/ng-template" id="myModalContent.html"> <div class="modal-header"> <h3>The Customer Name is: {{ customer.name }}</h3> </div> <div class="modal-body"> This is where the Customer Details Goes<br /> {{ customer.details }} </div> <div class="modal-footer"> </div> </script> </div> </div>
Controller:
app.controller('CustomerController', function($scope, $timeout, $modal, $log, customerServices) { $scope.customers= customerServices.getCustomers(); // MODAL WINDOW $scope.open = function () { var modalInstance = $modal.open({ templateUrl: 'myModalContent.html', }); }; });
The above opens a modal window. However, client data, such as {{customer.name}} from ng-repeat, is not passed to the modal window. Is there something wrong with the controller?
I am trying to create this by looking at the Angular Bootrap UI example here: http://angular-ui.imtqy.com/bootstrap/
EDIT:
Here is a jsfiddle example: http://jsfiddle.net/Alien_time/8s9ss/3/
source share