Skip to content

Commit

Permalink
Mostrando as categorias
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscolopes committed May 3, 2018
1 parent 86d1168 commit 78ff363
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/config/api.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const API_CONFIG = {
baseUrl: "http://localhost:8080"
baseUrl: "http://localhost:8080",
bucketBaseUrl: "https://s3-sa-east-1.amazonaws.com/curso-spring-ionic-francisco"
}
9 changes: 8 additions & 1 deletion src/pages/categorias/categorias.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@
</ion-header>

<ion-content padding>
<p>Página de categorias</p>
<ion-list>
<button ion-item *ngFor="let item of items">
<ion-thumbnail item-start>
<img src="{{bucketUrl}}/cat{{item.id}}.jpg">
</ion-thumbnail>
<h2> {{ item.nome }} </h2>
</button>
</ion-list>
</ion-content>
9 changes: 8 additions & 1 deletion src/pages/categorias/categorias.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { CategoriaService } from '../../services/domain/categoria.service';
import { CategoriaDTO } from '../../models/categoria.dto';
import { API_CONFIG } from '../../config/api.config';



/**
* Generated class for the CategoriasPage page.
Expand All @@ -16,6 +20,9 @@ import { CategoriaService } from '../../services/domain/categoria.service';
})
export class CategoriasPage {

bucketUrl: string = API_CONFIG.bucketBaseUrl;
items: CategoriaDTO[];

constructor(
public navCtrl: NavController,
public navParams: NavParams,
Expand All @@ -25,7 +32,7 @@ export class CategoriasPage {
ionViewDidLoad() {
this.categoriaService.findAll()
.subscribe(response => {
console.log(response);
this.items = response;
},
error => {
console.log(error);
Expand Down

0 comments on commit 78ff363

Please sign in to comment.