我与Angular的ng-show
有问题,我一直在寻找答案,看起来没有任何工作。当按钮被点击时,我需要显示窗体,但没有。按钮调用了一个其中有console.log
功能和它的作品,但演出并没有改变其状态,这里的代码:Angular.js ng-show无法正常工作
<div class="row" ng-controller="MyCtrl">
<form ng-show="show">
<input type="text" ng-model="name" placeholder="Name" required>
</form>
<a href="#"class="button large" ng-click="showAddForm()">Show Me!</a>
</div>
在app.js:
.controller('MyCtrl', ['$scope',function($scope) {
$scope.showAddForm = function(){
console.log("click click");
$scope.show = true;
};
}]);
已包含在你的项目angularjs.css文件?当它假设隐藏时,元素应该有'ng-hide'类 –
你还可以尝试'ng-if'而不是'ng-show'(这将验证Alon的评论) – floribon
我还没有听说过“angularjs。 css“文件。有'ng-hide',但是在添加'ng-show'后,整件事消失了,所以我想我需要先展示它。 – EDGECRUSHER