AngularJs ngIf vs ngShow
by obalais
HTML
<div ng-app>
<div ng-controller="MyCtrl">
<label>Afficher / masquer</label> <input type="checkbox" ng-model="show" />
<div>
<label>Scope parent</label> <input type="text" ng-model="value" />
</div>
<div ng-show="show">
<label>ngShow</label> <input type="text" ng-model="value" />
</div>
<div ng-if="show">
<label>ngIf</label> <input type="text" ng-model="value" />
</div>
</div>
</div>
CSS
label {
width: 120px;
display: inline-block;
}
JavaScript
function MyCtrl($scope) {
$scope.show = true;
$scope.value = "gouzigouza";
}