Angularjs:ng设置为true后显示不显示

Angularjs:ng设置为true后显示不显示,angularjs,angularjs-ng-show,Angularjs,Angularjs Ng Show,但按钮“呼叫”未显示(警报已显示)。出了什么问题?提前感谢。您需要将服务调用嵌入函数中 $scope.isVisible = false; myService.callMe().success(function (response) { $scope.isVisible = true; alert("enabled"); } 我不知道您为什么在这里使用服务,您可以不使用服务 $scope.callMe = function(){ myService.callMe().succe

但按钮“呼叫”未显示(警报已显示)。出了什么问题?提前感谢。

您需要将服务调用嵌入函数中

$scope.isVisible = false;
myService.callMe().success(function (response) {
    $scope.isVisible = true;
    alert("enabled");
}
我不知道您为什么在这里使用服务,您可以不使用服务

$scope.callMe = function(){
myService.callMe().success(function (response) {
    $scope.isVisible = true;
    alert("enabled");
}
}

我实际上已经将它嵌入到函数中。但是没有效果。即使没有调用callMe(),我们是否可以修改$scope.isVisible?这很奇怪,您是否可以生成一个PlunkRoh等等,您不需要在这里提供服务。检查修改后的应答,它在函数中实际运行。但是如果callMe()没有被调用,而我只想显示来自其他方法的按钮(设置为true),该怎么办呢。可能吗?如何单击不可见的按钮?
$scope.callMe = function(){
myService.callMe().success(function (response) {
    $scope.isVisible = true;
    alert("enabled");
}
}
$scope.callMe = function(){    
    $scope.isVisible = true;
    alert("enabled");     
}