我是angularjs的新手。 当我点击“Click Me”时,toggle
方法被调用。 test
的值从false更改为true,但ng-hide
未确认新值test
。ng-hide无法正常工作
<div ng-app="myApp" ng-controller="myCtrl">
<table>
<tr>
<td><span ng-hide="{{test}}">Testing</**strong text**td>
<td><span>hello</span></td>
</tr>
<tr>
<td style="cursor:pointer"><span ng-click="toggle()">Click Me</td>
<td><span>hello</span></td>
</tr>
</table>
</div>
的script.js
var appX = angular.module('myApp', []);
appX.controller('myCtrl', function($scope){
$scope.test = false;
$scope.toggle = function(){
$scope.test = true;
console.log("toggle is working");
};
});
你并不需要提供牙套有尝试这样'NG隐藏= “测试”' – Jigar7521
@ Jigar7521谢谢。这是工作。 – VivekT
是的,这是我提供的答案,下面更简短:) – Jigar7521