When using ng-repeat I need to print only 5 lines
I tried as below
<div ng-app="myApp" ng-controller="myCtrl"> <div ng-repeat="n in names"> <input type="checkbox" ng-click="select(n)"/>{{n}} <br ng-if="($n+1)%5==0"> </div> </div>
But all lines are printed on one line
http://jsfiddle.net/9fR23/474/
You may have this:
<div ng-repeat="n in names" style="display: inline"> <input type="checkbox" ng-click="select(n)"/>{{n}} <div ng-show="($index + 1) % 5 === 0"> <br> </div> </div>
working violin
<div ng-app = "myApp" ng-controller="myCtrl"> <div ng-repeat="n in names"> <input type="checkbox" ng-click="select(n)"/> <br ng-if="($index+1)%5==0"> </div> </div>
<div ng-app="myApp" ng-controller="myCtrl"> <span ng-repeat="n in names"> <input type="checkbox" ng-click="select(n)"/>{{n}} <div ng-if="($index+1)%5==0"><br></div> </span> </div>
<p></p>
<!DOCTYPE html> <html> <head> <title></title> <script type="text/javascript" src="https://code.angularjs.org/1.1.4/angular.js"></script> <script type="text/javascript"> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.names = ["Emil1", "Tobias2", "Linus3","Emil4", "Tobias5", "Linus6","Emil7", "Tobias8", "Linus9","Emil10", "Tobias11", "Linus12","Emil13", "Tobias", "Linus"]; $scope.selectedNames = []; $scope.select = function(name) { var index = $scope.selectedNames.indexOf(name); if(index < 0) $scope.selectedNames.push(name); else $scope.selectedNames.splice(index, 1); } }); </script> </head> <body> <div ng-app="myApp" ng-controller="myCtrl"> <div ng-repeat="n in names"> <input type="checkbox" ng-click="select(n)"/>{{n}} <p ng-show="($index+1)%5==0"></p> </div> </div> </body> </html>
, divs 100%. bootstrap:
<div ng-app="myApp" ng-controller="myCtrl" class="row"> <div ng-repeat="n in names" class="col-xs-2"> <input type="checkbox" ng-click="select(n)"/>{{n}} </div> </div>
http://jsfiddle.net/f4yb539x/
5 , col.
Source: https://habr.com/ru/post/1677419/More articles:Can an Azure website / application determine its processor / instance memory usage? - asp.net-mvcLocal Google app host development - google-app-engineError message in the return statement. - javaFetchOptions withLimit () does not reduce query execution time (Google App Engine) - google-app-engineEffective geometry support for landscape physics - c ++Datastore fetch VS fetch (keys_only = True), then get_multi - performancehttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1677421/does-amazon-sns-support-window-desktop-notification&usg=ALkJrhizyRTPlybB0MhJNUXrTkfSVld9Iwscala convert Int => Seq [Int] to Seq [Int => Int] - scalaКак назначить custome определить уникальный номер для entitiy в GAE? - javaWhy does Google Cloud SQL (using JDBC) take longer to insert records from the Google App Engine than from my personal computer? - google-app-engineAll Articles