debug why its zero. perhaps $routeParams.Id is zero.
controller issue
Hello, Iam passing project id using angular script "$scope.RenewalPDC.ProjectDetailId = $routeParams.Id;" but its passing 0 value in controller.. how to solve this?
3 answers
Sort by: Most helpful
-
-
Zhi Lv - MSFT 32,841 Reputation points Microsoft Vendor
2022-06-14T02:18:02.15+00:00 Hi @rashmitha r ,
The default value of the Int type is 0. So, the issue might relate that the
$routeParams.Id
is 0 or the parameter name is not matched, so the int type will use the default value.You can refer the following steps to debug your code:
First, as Bruce said, check the
$routeParams.Id
, whether it is zero or not?
Second, use F12 developer tools to check transfer data in the http request, check the parameter name and value whether they are correct.
Finally, in the Controller, check the parameter name, make sure it's using the same parameter name to receive the value.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.Best regards,
Dillion -
rashmitha r 21 Reputation points
2022-06-14T04:40:25.63+00:00 thank you for your time, values are passing in but even though data is in scope ".success(function (data) {" it is going inside the function.