I am trying to make an edit form pop-up as the show page but I am unable to get the data in popup html. Pop-up Code:
<script type="text/ng-template" id="myModalContent.html">
<div class="modal-header">
<h3 class="modal-title">I am a modal!</h3>
</div>
<div class="modal-body">
<h1>{{ visitor11.first_name }}</h1>
<div ng-app="VisitorCenter" ng-controller="visitorsController">
<div ng-repeat="visitor22 in visitors">
<p>{{ visitor22.first_name }} {{ visitor22.last_name }}</p>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()">OK</button>
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
</script>
But this "{{ visitor11.first_name }}" is not working.
Js file:
$scope.open = function (index) {
visitor = $scope.visitors[index]
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: 'ModalInstanceCtrl',
// size: size,
resolve: {
visitor11: function(){
alert(visitor.first_name +" "+ visitor.last_name);
return visitor;
}
}
});
return visitor;
};
ModalInstanceCtrl:
visitorCenter.controller('ModalInstanceCtrl', function ($scope, $modalInstance) {
$scope.ok = function () {
$modalInstance.close();
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
});
How can I get this 'visitor' object in my popup html. Please don't try to make any sense of my code above because it won't make any. i am just doing random stuff for learning angularJs. Just look at the problem.