Base solution for your next web application
Open Closed

Angular Routing #698


User avatar
0
paddyfink created

Hello

I have the following routing configuration:

app.config([
        '$stateProvider', '$urlRouterProvider',
        function ($stateProvider, $urlRouterProvider) {
            $urlRouterProvider.otherwise('/');

            if (abp.auth.hasPermission('Pages.Tenants')) {
                $stateProvider
                    .state('tenants', {
                        url: '/tenants',
                        templateUrl: '/App/Main/views/tenants/index.cshtml',
                        menu: 'Tenants' 
                    });
                $urlRouterProvider.otherwise('/tenants');
            }

            $stateProvider
                .state('home', {
                    url: '/',
                    templateUrl: '/App/Main/views/home/home.cshtml',
                    menu: 'Home' 
                })
                .state('about', {
                    url: '/about',
                    templateUrl: '/App/Main/views/about/about.cshtml',
                    menu: 'About' 
                })
                .state('suppliers', {
                    url: '/suppliers',
                    templateUrl: '/App/Main/views/suppliers/index.cshtml',
                    menu: 'Suppliers' 
                })
                .state('supplierDetail', {
                    url: '/suppliers/:id',
                    templateUrl: '/App/Main/views/suppliers/detail.cshtml',
                    menu: 'Suppliers'
                });
        }
    ]);

But it doesn't work for the supplier detail. The folowing url doesn't work and keep redirect me to the home page : <a class="postlink" href="http://localhost:4000/#/Suppliers/809d3d83-7cbd-e511-beea-6c8814f37e8c">http://localhost:4000/#/Suppliers/809d3 ... 8814f37e8c</a>

I'm beginner in angular and I'm sure it must be something stupid, but I can't find where the problem is. There is no error message in the log or in the browser console. I don't know where to look. I've looked the angular-ui routing documentation and I didn't find something to point me to the right direction.

am I missing something in the configuration? Thanks for your help.


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

    Your code seems true. I did similar thing here: <a class="postlink" href="https://github.com/aspnetboilerplate/eventcloud/blob/master/src/EventCloud.Web/App/Main/app.js#L26">https://github.com/aspnetboilerplate/ev ... app.js#L26</a> and it's working. Maybe your browser has cached the page. Always browse your application while developer tools (F12) open and check "disable cache while devtools are open" option.

  • User Avatar
    0
    proovit created

    Hi Paddyfink,

    Did you ever solve it? I have the same issue here.

    Thank you,

    Erik

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you share your routing definition as well. Maybe we can findout something.

  • User Avatar
    0
    andmattia created

    Hi

    if you user Redis try to empty redis cache.

    mat

  • User Avatar
    0
    paddyfink created

    Hi,

    I solved it by empty the cache.