How to send an object to action method in angular ui-router

Viewed 158

I am trying to make a SPA using angular ui-router. This is my app.js

var productCatalogApp = angular.module('ProductCatalog', ['ui.router']);
productCatalogApp.config(function ($stateProvider, $urlRouterProvider) {  

$stateProvider

    // route to show our basic form (/form)
    .state('wizard', {
        url: '/wizard',
        templateUrl: 'WizardSubForm',
        controller: 'WizardMainController'
    })

    // nested states 
    // each of these sections will have their own view
    // url will be nested (/form/profile)
    .state('wizard.offer', {
        url: '/offer',
        templateUrl: 'OfferForm',
        controller: 'OfferCtrlr'
    })

    // url will be /form/interests
    .state('wizard.customizations', {
        url: '/customizations',
        templateUrl: 'OfferCustomizations',
        controller: 'CustomizationCtrlr',
    });


// catch all route
// send users to the form page 
$urlRouterProvider.otherwise('/wizard');

});

The templateUrl in each state is the name of action method. This is the action method which is called when i click on OfferCustomizations.

  public virtual ActionResult OfferCustomizations(string data)
    {
        OfferCustomization offerCustomization = new OfferCustomization();
        //offerCustomization.ProviderId = loginUser.ProviderId;
        offerCustomization.ProductCatalogApiUrl = ProductCatalogApiUrl;
        return View(offerCustomization);
    }

Now i want to send an object to the action method but i have no clue how to do it. Please help.

1 Answers
Related