Speak, all right? I will describe the process that is leaving me with doubt. I have a list of elements that is populated with with data that I have. When I click on an item in the list, I want the application to open a detail page for the list I created.
Ex: - Item 1: POTATO - Item 2: BANANA
By clicking on item 1, I want a description about the potato. NOTE: I want to use only one details page and templating it according to an id that 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 get to understand .. Strong hug.