Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Different behavior in QA and local development
Message
From
09/12/2015 12:19:32
 
General information
Forum:
Javascript
Category:
Other
Miscellaneous
Thread ID:
01628590
Message ID:
01628738
Views:
31
This message has been marked as a message which has helped to the initial question of the thread.
>>>>>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);
>            });
>        };
Still think I may be right about the cause of the behaviour. If the data is downloaded async then with ng-show the DOM element may be in place and see a change in the data. With ng-if the element may be created after the download is complete ?
Previous
Reply
Map
View

Click here to load this message in the networking platform