Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which version you're using?
Message
 
 
À
Tous
Information générale
Forum:
Javascript
Catégorie:
Autre
Titre:
Which version you're using?
Divers
Thread ID:
01624940
Message ID:
01624940
Vues:
59
Hi everybody,

We're using the following versions of Angular.js and ui-router:
 * @license AngularJS v1.3.13
 * (c) 2010-2014 Google, Inc. http://angularjs.org
 * License: MIT
* State-based routing for AngularJS
 * @version v0.2.8
 * @link http://angular-ui.github.com/
 * @license MIT License, http://www.opensource.org/licenses/MIT
I believe I have the same problem as described in this very long thread

https://github.com/angular-ui/ui-router/issues/582

Here is my scenario. On the main Index page that displays the rows I have 2 buttons New and Create Daily. They both are supposed to call the same API controller method but with different parameters and therefore return different model. I have the following states defined at the top of my js file:
 app.config(['$stateProvider', function ($stateProvider) {
        $stateProvider.state('home', {
            url: '/',
            controller: 'max4salesController',
            template: ''
        }).state('edit', {
            url: '/edit/:id',
            controller: 'max4salesCrudController',
            templateUrl: 'CapacityControl/max4sales/editForm'
        }).state('new', {
            url: '/new',
            controller: 'max4salesCrudController',
            templateUrl: 'CapacityControl/max4sales/editForm'
        }).state('department', {
            url: '/newDepartment/:departmentId',
            controller: 'max4salesCrudController',
            cache: false,
            templateUrl: 'CapacityControl/max4sales/editForm'
        }).state('category', {
            url: '/newCategory/:categoryId',
            controller: 'max4salesCrudController',
            cache: false,
            templateUrl: 'CapacityControl/max4sales/editForm'
        }).state('item', {
            url: '/newItem/:itemId',
            controller: 'max4salesCrudController',
            cache: false,
            templateUrl: 'CapacityControl/max4sales/editForm'
        }).state('subCategory', {
            url: '/newSubCategory/:subCategoryId',
            controller: 'max4salesCrudController',
            cache: false,
            templateUrl: 'CapacityControl/max4sales/editForm'
        }).state('deleteRanges',
            {
                url: '/deleteRanges',
                controller: 'max4salesCrudController',
                cache: false,
                templateUrl: 'CapacityControl/max4sales/deleteRanges'
            });
    }]);
and the buttons essentially call the following:
if ($scope.searchParameters.categoryId != 0) {
                    window.console && console.log('Going to category state...')
                    $state.go('category', { categoryId: $scope.searchParameters.categoryId, createDaily: createDaily },{ reload: true });
                }
and so I expect that my 'max4salesCrudController' Init method is going to fire, but this is not happening when I add a new row, press save, then click on the Create Daily. If I click on Create Daily again after cancelling, it does go now to the Init of my controller and calling APIController method.

Can you tell me if it's worth investigating upgrading our current Angular.js and ui-router files to the latest (but not the re-write of angular.js, obviously).

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform