I want my application to display only 9 subdivs/images (with id #menu-entry) in one row which is inside ngReapet. My code is following but it displays only one entry.
<menu role="main-menu" type="toolbar" class="hidden-xs">
<div ng-repeat="game in allGames | orderBy: 'gamename'">
<div id=#row class="col-lg-12 col-md-12 col-sm-12" ng-if="($index +1) % 9 == 1">
<div class="menu-entry">
<a href="category?game={{game.gameid}}" title="{{game.gamename}}!">
<img src="img/icons/{{game.gamename}}_logo.png" alt="Przejdź do działu z {{game.gamename}}!" class="img-responsive" />
</a>
</div>
</div>
<div ng-if="(($index +1) % 9 == 0) || $index == $last "></div>
</div>
</menu>
Hot to fix it to display all menu-entries, 9 in row, displaying as much rows as needed.
<div ng-init="arr=[1,2,3,4,5,6,7,8,9,437,67,436,345,54,1,2,3,4,5,6]"></div>
<span ng-repeat = "i in arr track by $index">
<span>{{i}}</span>
<div ng-if="($index+1)%9==0"></div>
</span>
Even you can use div instead of span but make sure that
<span ng-repeat = "i in arr track by $index">
<span>{{i}}</span>
if you make the above lines to divs, their display property should be inline-block and
<div ng-if="($index+1)%9==0"></div>
its display property should be block to get 9 divs in each row.
https://plnkr.co/edit/Y2cJrUGYcygvM9i6wKx5?p=preview
I made it in following way but maybe there is shorter version? Maybe ngRepeat inside ngRepeat?
<menu role="main-menu" type="toolbar" class="hidden-xs">
<div ng-repeat="game in allGames | orderBy: 'gamename'">
<div class="col-lg-12 col-md-12 col-sm-12" ng-if="$index % 9 == 0">
<div class="menu">
<a href="category?gameid={{allGames[$index].gameid}}" title="{{allGames[$index].gamename}}!">
<img src="img/icons/{{allGames[$index].gamename}}_logo.png" alt="Przejdź do działu z {{allGames[$index].gamename}}!" class="img-responsive" />
</a>
</div>
<div class="menu">
<a href="category?gameid={{allGames[$index+1].gameid}}" title="{{allGames[$index+1].gamename}}!">
<img src="img/icons/{{allGames[$index+1].gamename}}_logo.png" alt="Przejdź do działu z {{allGames[$index+1].gamename}}!" class="img-responsive" />
</a>
</div>
<div class="menu">
<a href="category?gameid={{allGames[$index+2].gameid}}" title="{{allGames[$index+2].gamename}}!">
<img src="img/icons/{{allGames[$index+2].gamename}}_logo.png" alt="Przejdź do działu z {{allGames[$index+2].gamename}}!" class="img-responsive" />
</a>
</div>
<div class="menu">
<a href="category?gameid={{allGames[$index+3].gameid}}" title="{{allGames[$index+3].gamename}}!">
<img src="img/icons/{{allGames[$index+3].gamename}}_logo.png" alt="Przejdź do działu z {{allGames[$index+3].gamename}}!" class="img-responsive" />
</a>
</div>
<div class="menu">
<a href="category?gameid={{allGames[$index+4].gameid}}" title="{{allGames[$index+4].gamename}}!">
<img src="img/icons/{{allGames[$index+4].gamename}}_logo.png" alt="Przejdź do działu z {{allGames[$index+4].gamename}}!" class="img-responsive" />
</a>
</div>
<div class="menu">
<a href="category?gameid={{allGames[$index+5].gameid}}" title="{{allGames[$index+5].gamename}}!">
<img src="img/icons/{{allGames[$index+5].gamename}}_logo.png" alt="Przejdź do działu z {{allGames[$index+5].gamename}}!" class="img-responsive" />
</a>
</div>
<div class="menu">
<a href="category?gameid={{allGames[$index+6].gameid}}" title="{{allGames[$index+6].gamename}}!">
<img src="img/icons/{{allGames[$index+6].gamename}}_logo.png" alt="Przejdź do działu z {{allGames[$index+6].gamename}}!" class="img-responsive" />
</a>
</div>
<div class="menu">
<a href="category?gameid={{allGames[$index+7].gameid}}" title="{{allGames[$index+7].gamename}}!">
<img src="img/icons/{{allGames[$index+7].gamename}}_logo.png" alt="Przejdź do działu z {{allGames[$index+7].gamename}}!" class="img-responsive" />
</a>
</div>
<div class="menu">
<a href="category?gameid={{allGames[$index+8].gameid}}" title="{{allGames[$index+8].gamename}}!">
<img src="img/icons/{{allGames[$index+8].gamename}}_logo.png" alt="Przejdź do działu z {{allGames[$index+8].gamename}}!" class="img-responsive" />
</a>
</div>
</div>
</div>
</menu>
Related
This is snippet code.
<div class="row col-xs-12">
<a *ngFor="let rec of recipe "href="#" class="list-group-item clearfix">
<div class="float-left">
<h4 class="list-group-item-heading">{{rec.name}}</h4>
<p class="list-group-item-text">{{rec.description}}</p>
</div>
<span class="float-right">
<img [src]="rec.imagePath" alt="{{rec.name}}" class="img-responsive" style="max-height: 50px;">
</span>
</a>
<app-recipe-item></app-recipe-item>
I wonder why float-right don't align image to right side. If i use insetead pull-right it's working.I have read that bootstrap 4 we should float rather than pull.
I deleted list-group-item, list-group-item-heading , list-group-item-text and it worked.
<a href="#" class="clearfix" *ngFor="let recipe of recipes">
<div class="float-left">
<h4>{{ recipe.name }}</h4>
<p>{{ recipe.description }}</p>
I solved this by removing the xs-12 specifier in the col class.
<div class="row">
<div class="col">
<a href="#" class="list-group-item clearfix" *ngFor="let recipe of recipes">
<div class="float-left">
<h4 class="list-group-item-heading">{{ recipe.name }}</h4>
<p class="list-group-item-text">{{ recipe.description }}</p>
</div>
<span class="float-right">
<img
[src]="recipe.imagePath"
alt="{{ recipe.name }}"
class="img-responsive"
style="max-height: 50px"
/>
</span>
</a>
<app-recipe-item></app-recipe-item>
</div>
</div>
I am new in angular JS and highly appreciate if somebody helps me with the problem.I am trying to bind my gallery.html file to index.html row class div using ng-include directive.The problem is though the gallery is bound it isn't responsive.Here is my code:
<body ng-app='myApp'>
<div class='container'>
<div class='row' ng-include="'gallery.html'">
</div>
</div>
<script>
var myApp = angular.module("myApp",[]);
</script>
</body>
And here is my gallery.html code:
<div class="col-md-4">
<div class="thumbnail">
<div class='img_container'>
<a href="#">
<img src="img/1.jpg" class="img-responsive" alt="Lights">
</a>
</div>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<div class='img_container'>
<a href="#">
<img src="img/2.jpg" class="img-responsive" alt="Nature">
</a>
</div>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<div class='img_container'>
<a href="#">
<img src="img/3.jpg" class="img-responsive" alt="Fjords">
</a>
</div>
</div>
</div> <div class="col-md-4">
<div class="thumbnail">
<div class='img_container'>
<a href="#">
<img src="img/3.jpg" class="img-responsive" alt="Fjords">
</a>
</div>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<div class='img_container'>
<a href="#">
<img src="img/3.jpg" class="img-responsive" alt="Fjords">
</a>
</div>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<div class='img_container'>
<a href="#">
<img src="img/3.jpg" class="img-responsive" alt="Fjords">
</a>
</div>
</div>
</div>
Here are my html:
<div masonry id="graphicGridDiv">
<div class="masonry-brick" ng-switch on="{{graphic.length}}" ng-repeat="graphic in graphicArray">
<div ng-switch-when="1" class="col-sm-4 gra-mix-graphic ">
<div class="category_1 custom-menu-preview mix" ng-click="singleGraContent(graphic[0].id)">
<p class="video_title" title="title" ng-bind="$parent.graphic[0].name"></p>
<div class="gra-mix-inner">
<img ng-src="{{$parent.graphic[0].src}}" class="img-responsive">
</div>
<div class="caption">
<p class="video_detail" title="digest" ng-bind="$parent.graphic[0].digest"></p>
</div>
<div class="gra-mix-details-t">
<a class="mix-link but" title="delete" ng-click="graDelete($parent.graphic[0].id)">
<i class="fa fa-times"></i>
</a>
<a class="mix-preview but fancybox-button" title="edit" ng-click="graEdit(graphic[0])" >
<i class="fa fa-pencil"></i>
</a>
</div>
</div>
</div>
<div ng-switch-default class="col-sm-4 gra-mix-graphic">
<div class="gra-mix-details-t">
<a class="mix-link" title="delete" ng-click="graDelete(id)">
<i class="fa fa-times"></i>
</a>
<a class="gra-mix-preview fancybox-button" ng-click="graEdit(id)" title="edit**strong text**" data-rel="fancybox-button">
<i class="fa fa-pencil"></i>
</a>
</div>
<div class="category_1 custom-menu-preview" ng-click="multiGraContent(id)">
<div class="gra-mix-inner thumbnail">
<img ng-src="{{graphic[0].src}}" class="img-responsive" style="width: 330px;">
</div>
<div class="multiFirstTitle">
<p class="video_sub_title" title="{{graphic[0].name}}" ng-bind="graphic[0].name"></p>
</div>
<div class="multi" ng-repeat="mutiGra in graphic | arrayLimitFilter:1 ">
<p title="{{mutiGra.name}}" ng-bind="mutiGra.name" class="video_artical_title"></p>
<div class="multiImage" id="multiImageDiv">
<img ng-src="{{mutiGra.src}}" class="multiImage">
</div>
</div>
</div>
</div>
</div>
</div>
Here is the actual error text:
at Object.$watchCollectionAction [as fn] <div class="masonry-brick ng-scope" ng-switch="" on="{{graphic.length}}"
ng-repeat="graphic in graphicArray">
ng-controller is not specified anywhere in your HTML. Assuming your controller is named masonry you need to add ng-controller="masonry" to your outer div.
i'm trying to create a carousel that inside of it will be scrollable div with images.
The problem is that the swipe events conflict with eachother.
Plunker (the images are on slide 2)
My code:
<div class="carousel-demo">
<ul rn-carousel rn-carousel-index="carouselIndex" rn-carousel-buffered class="carousel1">
<li ng-swipe-left="left($event)">slide #1</li>
<li ng-swipe-right="right($event)">slide #2
<div class="horizontal-slide">
<div class="span2">
<a href="#" class="thumbnail">
<img src="http://placehold.it/150x100" alt="" />
</a>
</div>
<div class="span2">
<a href="#" class="thumbnail">
<img src="http://placehold.it/150x100" alt="" />
</a>
</div>
<div class="span2">
<a href="#" class="thumbnail">
<img src="http://placehold.it/150x100" alt="" />
</a>
</div>
<div class="span2">
<a href="#" class="thumbnail">
<img src="http://placehold.it/150x100" alt="" />
</a>
</div>
</div>
</li>
<li>slide #3</li>
</ul>
Thank's alot
Avi
Can someone help me with this? Everything works fine except when you click the right control it goes to the last slide, when you click the left it always goes to the second slide, here is the code.
<!-- BEGIN Carousel Element -->
<div class="container">
<div id="carousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="carousel" data-slide-to="0" class="active"></li>
<li data-target="carousel" data-slide-to="1"></li>
<li data-target="carousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper -->
<div class="carousel-inner">
<div class="item active" data-slide-number="0">
<img src="img/lol1.jpg" alt="">
<div class="carousel-caption">
<h3>Pentakill - Smite and Ignite Now Available</h3>
</div>
</div>
<div class="item" data-slide-number="1">
<img src="img/d3ros.jpg" alt="">
<div class="carousel-caption">
<h3>Diablo 3</h3>
<p>Reaper of Souls</p>
</div>
</div>
<div class="item" data-slide-number="2">
<img src="img/twitchtv.jpg" alt="">
<div class="carousel-caption">
<h3>Twitch.TV Streaming</h3>
<p>Coming Soon</p>
</div>
</div>
</div>
<a class="left carousel-control" href="#carousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
<script type="text/javascript" >
$('.carousel').carousel();
</script>
</div>