Javascript angularjs ng show工作不完美

Javascript angularjs ng show工作不完美,javascript,angularjs,ng-show,Javascript,Angularjs,Ng Show,我想显示和隐藏带有ng show指令的按钮 这是我的HTML文件: <button class="btn btn-info" ng-show="editBtn">Save Edit <span class="glyphicon glyphicon-ok"></span> </button> myApp = angular.module("myApp", []); myApp.controller ("epmloy

我想显示和隐藏带有ng show指令的按钮

这是我的HTML文件

<button class="btn btn-info" ng-show="editBtn">Save Edit
        <span class="glyphicon glyphicon-ok"></span>
    </button>
    myApp = angular.module("myApp", []);

myApp.controller ("epmloyeeCtrl", ["$scope", function($scope){
  $scope.editBtn = false;
}]);

我认为您忘记了HTML中的
ng应用程序
ng控制器
。应该是:

<div ng-app="myApp">
   <div ng-controller="epmloyeeCtrl">
     <button class="btn btn-info" ng-show="editBtn">Save Edit
        <span class="glyphicon glyphicon-ok"></span>
      </button>
   </div>
</div>
我已经从您的代码中演示了关于
显示/隐藏编辑按钮的演示:

检查此Plnkr:

单击“编辑”按钮时,您似乎忘记更改$scope.editBtn的状态。在控制器的editEmployee函数中,必须添加:

$scope.editBtn=true;

另外,我添加了变量saveBtn以在用户编辑时隐藏。还添加了一个取消按钮。您可以在plnkr中检查这3个元素。

这段代码会发生什么?按钮会显示出来,或者我认为这段代码应该隐藏按钮。其余代码在哪里?我们没有足够的资源进行调试。你能在plunker上创建你的代码副本吗?如果您用ng if更改ng节目会怎么样?
$scope.editBtn=true;