0

i need to passe id using $routeParam. my code is like below

js file

var app = angular.module("myApp"); app.controller("quotationPendingController", function ($scope,$http,NgTableParams,$filter,$timeout,$rootScope,ModalService,$window){ $scope.loadQuotationDetailsOnQuotationForUpdate = function (quotation) { $window.location.href = ('quotation_approve.jsp#/?target='+quotation.quotationId+'&action=u'); } });
jsp file like below > Blockquote <a class="grid-btn row-edit" target="_blank" data-toggle="tooltip" data-placement="top" title="" data-original-title="Edit" ng-click="loadQuotationDetailsOnQuotationForUpdate(quotation)"><span class="glyphicon glyphicon-pencil"></span></a> 

i need to change loadQuotationDetailsOnQuotationForUpdate(quotation) function from $routeParam.

how i change below function

$scope.loadQuotationDetailsOnQuotationForUpdate = function (quotation) { $window.location.href = ('quotation_approve.jsp#/?target='+quotation.quotationId+'&action=u'); }

4
  • What does your routing look like? Why are you calling $window vs using $location? I think having a demo would help here. Commented Aug 3, 2017 at 16:22
  • when i click the link page is loading. but there no styles and script files. Commented Aug 3, 2017 at 16:24
  • Dear Brian.. can u do small example for me if not u busy Commented Aug 3, 2017 at 16:26
  • however i need to change loadQuotationDetailsOnQuotationForUpdate() function from using $routeParam Commented Aug 3, 2017 at 16:27

1 Answer 1

1

In Angular we can advise you to use a true router component to manage your navigation. For sample with ui-router (https://ui-router.github.io/ng1/) something like :

1) you can define a specific state for your jsp

$stateProvider .state('quotation_approve', { url: '/quotation_approve.jsp/:target/:action', templateUrl: 'quotation_approve.jsp', controller : "your template controller" }) 

2) then you will be abble to change the function to navigagte to your page

Don't forget then inject $state service to your controller

$scope.loadQuotationDetailsOnQuotationForUpdate = function (quotation) { $state.go('quotation_approve',{ "target": quotation.quotationId,"action":"u"}); } 
Sign up to request clarification or add additional context in comments.

2 Comments

hi jeremy... i followed your code. now issue is quotation_approve.jsp not loading.
do you have an error like 404? could you check the path to get your file ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.