Good evening. I'm using Bootstrap pagination with Angular.js. I can get the bank details and list it, it looks beautiful, etc ... the way I needed it.
However, I need to open a modal window and this worked when I was using the javascript functions I know as OnClick.
But using angled paging, my onclick function does not work. Below is the link and documentation of pagination with Angula.js:
http://www.angularcode.com/angularjs-datagrid-paging-sorting-filter-using-php-and-mysql/
I have the following function to call:
<script type="text/javascript">
function detalhes(id) {
$('#myModal').modal('show');
$("#conteudoModal").load('verProduto.php?id=' + id);
}
And in the pagination, product list I have the button:
<td><button type="button" class="btn btn-primary btn-mini" data-toggle="modal" onclick="detalhes({{data.id}})">+ Detalhes</button></td>
The problem is here:
onclick="detalhes({{data.id}})"
The id arrives in this format: {{data.id}} , I have already used quotation marks, +,. and nothing rsrrsrsr Would there be any way to work this better? I do not understand much of Angular.js, I just took it and adapted it and it looked beautiful ... but I need the button to work ...
As requested, follow the controller:
var app = angular.module('produtos', ['ui.bootstrap']);
app.filter('startFrom', function() {
return function(input, start) {
if(input) {
start = +start; //parse to int
return input.slice(start);
}
return [];
}
});
app.controller('produtosCrtl', function ($scope, $http, $timeout) {
$http.get('../html/paginacao/ajax/getProdutos.php').success(function(data){
$scope.list = data;
$scope.currentPage = 1; //current page
$scope.entryLimit = 5; //max no of items to display in a page
$scope.filteredItems = $scope.list.length; //Initially for no filter
$scope.totalItems = $scope.list.length;
});
$scope.setPage = function(pageNo) {
$scope.currentPage = pageNo;
};
$scope.filter = function() {
$timeout(function() {
$scope.filteredItems = $scope.filtered.length;
}, 10);
};
$scope.sort_by = function(predicate) {
$scope.predicate = predicate;
$scope.reverse = !$scope.reverse;
};
});
Could you help me with this?