Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Code is executed second time with the wrong parameter
Message
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01622436
Message ID:
01622456
Vues:
55
I solved the problem. As often with me, it was self-inflicted and I spent a lot of time chasing it.

Here is the problem:
 }).state('new', {
>            url: '/new',
>            controller: 'max4salesCrudController',
>            templateUrl: '/CapacityControl/max4sales/editForm'
>        }).state('department', {
>            url: '/new/:departmentId',
>            controller: 'max4salesCrudController',
>            templateUrl: '/CapacityControl/max4sales/editForm'
>        }).state('category', {
>            url: '/new/:categoryId',
>            controller: 'max4salesCrudController',
            templateUrl: '/CapacityControl/max4sales/editForm'
        }).state('item', {
            url: '/new/:itemId',
            controller: 'max4salesCrudController',
            templateUrl: '/CapacityControl/max4sales/editForm'
        }).state('subCategory', {
            url: '/new/:subCategoryId',
            controller: 'max4salesCrudController',
            templateUrl: '/CapacityControl/max4sales/editForm'
        });
I remember when I was creating these states my original inclination was to use 'NewDepartment', 'NewCategory', etc. but then I thought it would not look nice in a url and used 'new' for all states. And apparently it somehow caused the view to execute twice the second time with the departmentId being 2. I changed URLs now the way I originally wanted to name them and all is well.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform