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? ~
世界只因有你2017-05-15 16:54:36
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
某草草2017-05-15 16:54:36
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;
});
};