1
Talk personal, all right? I’m going to describe the process that’s leaving me in doubt. I have a list of elements that is filled with data I have. When I click on a list item, I want the app to open a detail page referring to the list I created.
Ex: - Item 1: POTATO - Item 2: BANANA
When you click on item 1, I want a description about the potato. NOTE: I want to use only a detail page and templating it according to an id I transmit through the details page.
Look at my code.
RESULT.HTML
<ion-view view-title="Resultados">
<ion-content>
<ion-list>
<ion-item class="item item-avatar" ng-repeat="item in resultado" ng-click="openOnly(item)" href="#/app/resultado/{{item.id}}">
<img src="{{item.imagem}}" style="top: 27.5px;">
<h2>{{item.nome}}</h2>
<p>{{item.endereco}}</p>
<div class="star-avaliacao">
<i class="ion-star"></i>
<i class="ion-star"></i>
<i class="ion-star"></i>
<i class="ion-star"></i>
<i class="ion-star"></i>
</div>
<i class="ion-chevron-right flechaFlutuante"></i>
<ion-option-button class="button-positive" ng-click="edit(item)">
Ligar
</ion-option-button>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
CONTROLLER.JS
.controller('ResultadosCtrl', function($scope) {
$scope.resultado = [
{ nome: 'Med Imagem', endereco: 'Rua Paissandu, 1862 - Centro', imagem:'../img/medimagem.jpg', id: 1},
{ nome: 'Clinica Maia', endereco: 'Av. Francisco H. dos Santos, 1190 - JDA', imagem:'../img/user.png', id: 2}
];
})
.controller('DetalheCtrl', function($scope, $stateParams) {
});
I hope you understand. Hug.