angularjs - How to take id from url and pass it to function? -


i have problem. have textbox need enter pin , button submit, , when user click on button popupt contains data pin. when user click on button display url :

http://localhost:60664/#?ticketid=87879578  

now need handle function when open in window link able see popup. how can that?

this function works on click:

$scope.showdetails = function (pin) {     if ($scope.showdetail == false && pin != null) {         $scope.pin = pin;           $http.get(url + 'get/' + $scope.pin)             .success(function(data, status, headers, config)              {                $("#background").addclass("darker");                 $scope.showdetail = true;                 $scope.notfound = false;                 $location.search('pinid', pinticket);               })             .error(function(data, status, headers, config) {                  $scope.notfound = true;                 $scope.showdetail = false;            })        .then(details, errorresponse);      }  } 

$location.search().ticketid 

should trick

so if want check if url has id, , if has, run function

if($location.search().ticketid) {   myfunction($location.search().ticketid); } 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -