Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sharing same views (with controllers) for several areas
Message
 
 
À
06/05/2015 02:57:34
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01619445
Message ID:
01619458
Vues:
23
>>Hi everybody,
>>
>>I am wondering what is the best way of sharing the same views between several areas?
>>
>>I have InvoicesList and I want to be able to present it from both Customer Accounts area and Guests Area. Originally Invoices (and all related functionality) was designed in the Customer Accounts area.
>>
>>Now I want to share it between these 2 areas.
>>
>>I moved and renamed the view. I named it InvoicesList and placed into Views/Shared folder in the project.
>>
>>In my controller js file I now have
>>
>>
>>$stateProvider
>>            .state('edit.invoices', {
>>                url: '/invoices:invoiceId?accountNameHash?isNew',
>>                views: {
>>                    'invoices': {
>>                        templateUrl: '/Views/Shared/InvoicesList',
>>                        controller: 'invoicesSearchController'
>>                    },
>>                    'detail': {
>>                        templateUrl: '/CustomerAccounts/Invoices/editForm',
>>                        controller: 'invoicesCrudController'
>>                    }
>>                }
>>            })
>>
>>In the AccountsController.cs I have now:
>>
>>
>> [Route("InvoicesList")]
>>        public ActionResult InvoicesList()
>>        {
>>            return PartialView();
>>        }
>>
>>but it's not going hit.
>>
>>It should be something relatively simple I am missing here, I hope.
>>
>>Do you see what change should I make in order to get that view from the Shared place?
>>
>>Thanks in advance.
>
>Is the 'detail' view being loaded ?
>If so then maybe you don't have a correct ui-view for 'invoices' in the html for the parent view ?

detail view is supposed to only load after I loaded the invoices list when I click on the individual invoice. In the parent form I have
<div class="col-sm-10 panel-container">
                                <div data-ui-view data-autoscroll="false"></div>
                                <div data-ui-view="invoices" data-autoscroll="false"></div>
                            </div>
My current working solution is to keep the view where it is (e.g. in Customer Accounts area) and just reference it this way from the Guests / Edit form view.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform