1
I have a mobile app I want the ng-repeat
create the content in a grid as I have in the example below but always repeat as an example below:
<div class="row responsive-md">
<div class="col">
<a href="#/app/comer">
<div class="img_comer">
<div class="texto_categorias_home">
<div><i class="fa-fa-cutlery"></i></div>
Comer
</div>
</div>
</a>
</div>
<div class="col">
<a href="#/app/dormir">
<div class="img_dormir">
<div class="texto_categorias_home">
<div><i class="fa-fa-bed"></i></div>
Dormir
</div>
</div>
</a>
</div>
</div>
In this case this manual now I want to do the same but in ng-repeat
how can I do ?
View ng-repeat
<div class="row" ng-repeat="noticias in noticias_home">
<div class="col">
<a href="#/app/ver-noticia/{{noticias.url_artigo}}/{{noticias.id}}">
<div style="background: url(https://www.sabeonde.pt/gtm/anexos/posts_home/{{noticias.id_anexo}}.{{noticias.tipo}}); border-top-left-radius:10px; border-top-right-radius:10px; height: 200px; background-size: 100% 100%; background-repeat: no-repeat;">
</div>
</a>
<div style="border-bottom-left-radius:10px; border-bottom-right-radius:10px; height: 100px; background-color: white;">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" valign="top">
<a href="#/app/ver-noticia/{{noticias.url_artigo}}/{{noticias.id}}"><div style="font-size: 15px; color:black; margin:5px 0px 15px 10px; font-weight: bold; ">{{noticias.titulo}}</div></a>
</td>
</tr>
<tr>
<td valign="top">
<div ng-init="liked='Gosto'" ng-click="like({{noticias.id}})" ng-controller="LikeNoticiasHome" style="margin-left:10px;" class="botao_gosto"><i class="fa fa-heart"></i> {{liked}}</div>
<div id="mostra_gostos" class="mostra_gostos">{{noticias.likeCount}}</div>
<div ng-click="partilhar({{noticias.id}})" ng-controller="PartilhaNoticiasHome" class="botao_posts"><i class="fa fa-share-alt"></i> Partilhar</div>
<a href="#/app/ver-noticia/{{noticias.url_artigo}}/{{noticias.id}}"><div class="botao_posts"><i class="fa fa-search"></i> Ver +</div></a>
</td>
</tr>
</table>
</div>
</div>
</div>
Controller
.controller('ListaNoticiasHome', function($scope, $http, $stateParams, sessionService) {
$http.get("https://www.sabeonde.pt/api/api_noticias_home.php").success(function (data) {
$scope.noticias_home = data;
});
})
You can edit and make an example based on what I have manual do for ng-repeat equal ?
– César Sousa
You can pass the Javascript code using Angularjs by filling the objects, attributes, arrays of your controller?
– Giancarlo Abel Giulian
I put in question the controller
– César Sousa