Hi, what is best practise in a SPA to pass a parameter to another page?
I need to pass the ID of a project to a details page with a button click in the list of projects. The ID should be used to filter project details, set the page heading, etc..
Thank you very much!
5 Answer(s)
-
0
Hi,
You can pass the parameter in your url like this 'http://yoursite.com/reservation/edit/1'.
In order to do that, define your state like thisin app.js,
$stateProvider.state('editGroupReservation', {
url: '/reservation/edit/{id}', templateUrl: '~/App/tenant/views/reservation/edit.cshtml' });
Then in order to get id parameter on redirected controller, you need to inject '$stateParams' into your controller. And you can get id parameter as "$stateParams.id".
-
0
Perfect - thank you very much!
Could you please tell me what I have to do to control which page is displayed as entry point in my SPA application? I don't want the Frontend Example to be the entry point, I would like the Tenant Dashboard to be the first page for logged in users and the Login Page for user who aren't logged in.
Thanks in advance!
-
0
Hi,
HomeController's Index action does that. You can make a redirection to ApplicationController's Index action in there.
-
0
Thanks a lot!
Could you give me another advice concerning the navigation and routing topic please? We want to use the "Left Tabs" from Metronic UI Features ([http://keenthemes.com/preview/metronic/theme/admin_4_material_design/ui_tabs_accordions_navs.html])) but if we do so and use the links with the leading #-sign it seems that the controller tries to detect the target and opens the dashboard that has the definition "$urlRouterProvider.otherwise".
Is it not possible to use the left tabs navigation? Thanks!
-
0
Hi,
You can use angular bootstrap's tabs <a class="postlink" href="https://angular-ui.github.io/bootstrap/#/tabs">https://angular-ui.github.io/bootstrap/#/tabs</a>. It has a template-url property.
But I'm not sure if it will work or not for navigation menu, you need to try and see :). We will be happy if you share your result ith us.