How to read data from parameter in URL

Nov 18 2021 7:33 PM

I have a page displaying a list of customers. Each customer on this page has a hyperlink to take them to a new page so the user can edit them: Edit This link works fine and i can see a single customer is loaded by ID when i add a console.log line on the page where the customer should be editable. The issue i have is no data is loaded on the edit page. I am using one controller to get the list and individual ID. At present i have very minimal code on the edit page i.e.

{{vm.customer.CId}}

So i am expecting the ID to appear but nothing despite console.log showing the data was loaded from the database. A snippet of my AngularJS loading the single record

vm.getCustomer = function getSingleCustomer(id) { customer.Resources.getCustomer(vm.customer.CId) .then(function (data) { console.log(data); }, function (data) { notificationsService.error("Error", "Could not get details."); }); }

As you can tell at this stage the data is loaded which displays in the console log. The details dont show up on the edit page and im struggling to workout why not?

Can anyone tell what im doing wrong or what i need to add? Edit i have read i may have to add a route, so amended as below

 angular.module("myappo") .config(function ($routeProvider) { $routeProvider .when("/#/mytestalias/customeralias/edit/:CId", { templateUrl: "//#/mytestalias/customeralias/edit.html", controller: "CustomerController" }); }) .controller....

However nothing happened here but again i cant determine if its my route or something else?