How to add get request parameter from url to controller in angularjs
e.g. my request is http://localhost/abc-ang/#!/abc/8
and my controller code is
app.controller('AbcCtrl', function($scope,$http) {
$http.get("src/public/add/:id").then(function (response) {
$scope.abc = response.data;
});
});
I want to replace src/public/add/:id
to src/public/add/8
how can I do that dynamically?
My routing configuration is
app.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/abc', {
templateUrl: "tpl/welcome.html"
})
.when('/abc/:wineId', {
templateUrl:'tpl/abc-details.html',
controller:'AbcDetailCtrl'
})
.otherwise({ redirectTo: '/abc' });
}]);