我是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