angular.js - angularjs ng-if element switching problem
黄舟
黄舟 2017-05-15 16:52:36
0
2
656

Currently, there is a multi-select box on the interface to select 1 or 0. The main thing is to ng-if judge 0 or 1 to switch between displaying two different p's.
Now there is a problem. When each p is switched, another p will always exist briefly, causing a delay in switching. Is there any good way? ~

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
世界只因有你

Are you sure the problem is caused by the ng-if directive? I built an example and didn't find any problems, and I didn't encounter any delays during development.

Test address: https://jsfiddle.net/mm0h7ves/

There is no reason to have delays in the UI, unless your script execution efficiency is too low or there are too many watchers on the page, causing the polling dirty check to be too slow

某草草

This is very simple. Before clicking to switch, just set the object output by the previous p to empty

$scope.use = function(status) {
            $scope.mycoupon = {};
            $scope.useFlag = status;
            mycouponService.getCouponsByMemberAndStatus(status, function(info) {
                $scope.mycoupon = info;
            });
        };
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template