I am creating a web app using different technologies.
First I am opening a HTML/PHP file like this http://....filename.php?id=23
At this file I am calling an external JS file, like this:
filename.php piece of code:
<script src="app/appClients.js"></script>
Here you have the code for appClients.js:
var app = angular.module('myApp', ['ui.bootstrap']);
app.filter('startFrom', function() {
return function(input, start) {
if(input) {
start = +start; //parse to int
return input.slice(start);
}
return [];
}
});
app.controller('customersCrtl', function ($scope, $http, $timeout) {
$http.get('ajax/getClientsContacts.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;
};
});
And at line:
$http.get('ajax/getClientsContacts.php').success(function(data){
I need to pass the id parameter from the first URL to file getClientsContacts.php, also as id parameter to the URL.
Any help is welcome.