data-ng-switch on with condition

Description

The following code shows how to use data-ng-switch on with condition.

Example


<!DOCTYPE html>
<html  ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript'>
angular.module('app', [])
function ParentCtrl($scope){}<!-- w  ww  .  ja v  a 2s . c om-->
</script>
</head>
<body>
  <div ng-app="app">
 <div ng-controller="ParentCtrl">
     <div class="block" ng-repeat="position in [1,2,3,4,5,6,7,8,9,10]" data-ng-switch on="($index + 1) % 4 == 0 && $index > 0">
  {{position+1}}
  <br data-ng-switch-when="true">
</div>
 </div>
</div>
</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities