Skip to content

Instantly share code, notes, and snippets.

@allenyang79
Created August 29, 2013 09:47
Show Gist options
  • Save allenyang79/6376171 to your computer and use it in GitHub Desktop.
Save allenyang79/6376171 to your computer and use it in GitHub Desktop.
angularjs ng-show test
<html = ng-app="app">
<body ng-controller="MyCtrl">
<div>
<ul>
<li ng-repeat="item in items">
<input type="checkbox" ng-model="item.show"/>
<span>{{item.name}}</span><br/>
{{item.show}}<br/>
<img src="{{item.img}}" ng-show="item.show"/>
</li>
</ul>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>
</body>
</html>
var app = angular.module('app',[]);
app.controller('MyCtrl', function($scope){
$scope.items=[];
$scope.items.push({
show:true,
name:"bill",
img:'http://www.placehold.it/50x50'
});
$scope.items.push({
show:true,
name:"merry",
img:'http://www.placehold.it/50x50'
});
$scope.items.push({
show:true,
name:"joe",
img:'http://www.placehold.it/50x50'
});
$scope.items.push({
show:true,
name:"brown",
img:'http://www.placehold.it/50x50'
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment