Base solution for your next web application
Open Closed

Routing between pages within menu- Dashboard using angularjs #4739


User avatar
0
OriAssurant created

Hi, Not able to route between cshtml pages within the same Dashboard Tab both having same permissions. I tried to put an url for my page in the app.js as well with same permission and Also added a value in the Navigations- PageName class. But its not working

if (abp.auth.hasPermission('Pages.Tenant.Dashboard')) { $urlRouterProvider.otherwise("/tenant/dashboard"); //Entrance page for a tenant $stateProvider.state('tenant.dashboard', { url: '/dashboard', templateUrl: '~/App/tenant/views/dashboard/index.cshtml' }); }

    if (abp.auth.hasPermission('Pages.Tenant.Dashboard')) {
     $urlRouterProvider.otherwise("/tenant/isvalidsim"); //Entrance page for a tenant
       $stateProvider.state('tenant.isvalidsim', {
         url: '/isvalimsim',
       templateUrl: '~/App/tenant/views/dashboard/isvalidsim.cshtml'
           
       });
    }

This is going to be similar to a partial page ajax rendering . Can you please send me a sample code i can look at ? Also is there a reason why you are using angularjs version 1.6.6 and not angular version 4 and above on the mvc-angularjs project.


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    @OriAssurant, do you have a javascript error on console ?

    We already have ASP.NET Core & Angular5 template but we are not planning to create a new template for MVC 5.x & Angular 5.

  • User Avatar
    0
    OriAssurant created

    somehow its does not show any error on console ..

    It shows the url on the left bottom of the page when I hover on the details button but when I click on it ..it does not redirect to that page

  • User Avatar
    0
    ismcagdas created
    Support Team

    @OriAssurant it is hard to detect this problem. Can you share your app.js and related cshtml & js files for your new view ?

    Thanks.

  • User Avatar
    0
    alper created
    Support Team

    Hi,

    If the new CSHTML places in the same page (not a complete page) then there's no need for routing. Routing is for just new pages! (no need to add something to app.js) As I understand you have a Dashboard and in the Dashboard you have a Tab Menu with multiple Tab Pages.

    Below I show you how to use Tabs with permission. Customize it according to your requirements.

    <div class="tabbable-custom ">
                <ul class="nav nav-tabs">
                    @if (IsGranted("Pages.Tenant.Dashboard.Report1"))
                    {
                        <li class="active">
                            <a data-target="#report1" data-toggle="tab">
                                <i class="fa fa-tags"></i>
                                Report1
                            </a>
                        </li>
                    }
    
                    @if (IsGranted("Pages.Tenant.Dashboard.Report2"))
                    {
                        <li>
                            <a data-target="#report2" data-toggle="tab">
                                <i class="fa fa-umbrella"></i>
                                Report2
                            </a>
                        </li>
                    }
                </ul>
    
                <div class="tab-content">
                    @if (IsGranted("Pages.Tenant.Dashboard.Report1"))
                    {
                        <div class="tab-pane active" id="report1">
                            @Html.Partial("~/App/Main/MyReports/Report1.cshtml")
                        </div>
                    }
    
                    @if (IsGranted("Pages.Tenant.Dashboard.Report2"))
                    {
                        <div class="tab-pane" id="report2">
                            @Html.Partial("~/App/Main/MyReports/Report2.cshtml")
                        </div>
                    }
                </div>
    
            </div>
    
  • User Avatar
    0
    OriAssurant created

    I have added the files i need for routing within the same Dashboard tab. Also attached 1 App_Start- > Navigation -> PageNames.cs where i added the permissions. Also added same permissions in the database for those pages added.

    Please review it and let me would i be able to implement wizard like functionality within the same tab .. Would appreciate any help from you. App.zip