Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Different behavior in QA and local development
Message
 
 
À
09/12/2015 10:24:20
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01628590
Message ID:
01628733
Vues:
32
>>>>BTW, my colleague solved the issue by switching to ng-if instead of ng-show for these two elements. Of course, it doesn't explain the Google Chrome ng-dirty bug, but it does solve that problem. And it's the second time this week he solved problem by implementing ng-if.
>>>>
>>>>https://stackoverflow.com/questions/19177732/what-is-the-difference-between-ng-if-and-ng-show-ng-hide#_=_
>>>
>>>As mentioned in an earlier reply : ng-show merely hides or shows the element - it's not removed from the DOM.
>>>ng-if removes or adds the element. I'd guess that with the data source changed and that, with ng-show that caused the ng-dirty to be set. With ng-if the element was created after the data was set so it would still be ng-pristine ?
>>
>>But that's the strange thing. All fields are bound to currentOperator fields. I've checked the controller's code and there was nothing changing these two particular fields (unless a specific method called to change them). That's why the behavior which was only in Chrome I'd consider a bug. But in any case, ng-if is a workaround against that bug.
>
>How is the data loaded ?

That's the code (not written by me, I just commented our the new part for setting opCode):
var loadOperator = function (id) {

            id = id || 'isNew';

            $scope.alertType = '';
            $scope.loadingTimeout = $timeout(function () {
                $scope.isEditLoading = true;
            }, 250);
            operatorsService.getOperator(id).then(function (data) {
                $scope.currentOperator = data;
                $scope.isNew = id == 'isNew' ? true : false;
                //// When creating a new form isNew was in OpCode textbox. Clear field for the user.
                //if ($scope.isNew) {
                //    $scope.currentOperator.opCode = '';
                //}
                $scope.showForm = true;
                $scope.alertType = '';
                $scope.isEditLoading = false;
                if ($scope.currentOperator.eMessage == '')
                    $scope.disableClearMessage = true;
                else
                    $scope.disableClearMessage = false;
                $timeout.cancel($scope.loadingTimeout);
                $timeout(function () {
                    $rootScope.$broadcast('sm:resizeContainer');
                    $rootScope.$broadcast('sm:focus');
                }, 0);
            });
        };
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform