Javascript angularjs烤面包机无法从粘性变为动态关闭

Javascript angularjs烤面包机无法从粘性变为动态关闭,javascript,angularjs,angular-ui-bootstrap,angular-ui,Javascript,Angularjs,Angular Ui Bootstrap,Angular Ui,我正在使用()并且我的要求是最初我需要使烤面包机变粘,在某些特定的按钮点击之后,所有的烤面包机都应该按照给定的时间间隔关闭。因此,最初我将超时设置为0,然后在pop2()函数中将超时设置为2000。我可以清楚地看到toasterOptions对象中的超时时间正在更改为2000,但所有的烤面包机仍然保持粘性 $scope.toasterOptions = {'time-out': 0, 'close-button':true, 'animation-class': 'toast-top-cent

我正在使用()并且我的要求是最初我需要使烤面包机变粘,在某些特定的按钮点击之后,所有的烤面包机都应该按照给定的时间间隔关闭。因此,最初我将超时设置为0,然后在
pop2()
函数中将超时设置为2000。我可以清楚地看到toasterOptions对象中的超时时间正在更改为2000,但所有的烤面包机仍然保持粘性

$scope.toasterOptions  = {'time-out': 0, 'close-button':true, 'animation-class': 'toast-top-center'};

$scope.pop1 = function(){
 toaster.success({title: "title1", body:"text1"});
};

$scope.pop2 = function(){
 toaster.success({title: "title2", body:"text2"});
 $scope.toasterOptions["time-out"] = 2000;
};

请参见

使用超时函数调用清除函数,以便在给定的时间范围内清除所有内容,并且不要忘记在控制器中添加$timeout

 $scope.pop2 = function(){
         toaster.success({title: "title2", body:"text2"});
        $timeout(function() {            
         $scope.clear();
    }, 2000);
    };

在调用
烤面包机
之前,您是否尝试过更改
烤面包机选项
?含义,在
$scope.pop2中