Skip to content Skip to sidebar Skip to footer

Loading JSON Content In Angular App, Depending On What Item The User Clicked

I have a table populated by a REST request to http://localhost:8080/Sprint002b/restpatent/. When a user clicks on one of the items in the table, which is located in list-patents.ht

Solution 1:

You can pass the data with state like below

$state.go('patents', {
  'projectId': projectId,
  'otherdata': otherdata
});

Your router will look like this

$stateProvider
  .state("patents", {
    url: "/patents/:parentId/:otherdata",
    templateUrl: "templates/patents/patent-nav.htm",
    controller: "patentCtrl"
  })

And you can get values in next controller like this

var projectId = $state.params.projectId;
var otherdata = $state.params.otherdata;

Post a Comment for "Loading JSON Content In Angular App, Depending On What Item The User Clicked"