ng-click更新$ scope但不显示视图上的更改

时间:2015-09-02 14:33:00

标签: angularjs angularjs-ng-click angularjs-ng-show

以下是我的代码..我更新了$ scope变量,即使在检查DOM但是视图没有更新时,模型也会按预期更改。我已经尝试了一切让我的观点显示没有运气。请帮助。

代码

//Initialize our Angular Application
var app = angular.module("myApp",[]);
app.controller("inputController",function($scope,$http,$interval){
	
	$scope.views ={
		login_screen : false,
		search_screen : false,
		picture_screen : false,
		txloss_screen : false,
		emptloaded_screen : false,
		kd_screen : false,
		tat_screen : false,
		info_screen : false
	};



	

	//show correct view
	$scope.showView = function(view){
		$scope.views[view] = true;
	}
<div class="container-fluid mainWrapper" ng-controller="inputController">
  
  ...
  <li><a href="#"  ng-click="showView('search_screen')">Search</a></li>
  
  ...
  
  <div class = 'row search_screen' ng-show="{{views.search_screen}}">
  ...
  </div>
  
  
</div>

1 个答案:

答案 0 :(得分:0)

ngShow不需要{{}} - 它已经需要一个Angular表达式:

ng-show="views.search_screen"