creada página feed

This commit is contained in:
onsaliyo 2021-04-04 19:17:26 +02:00
parent 427398154b
commit 277ad1d88a
13 changed files with 153 additions and 108 deletions

View File

@ -1,49 +1,53 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { LoginPage } from './login/login.page'; import { LoginPage } from './login/login.page';
const routes: Routes = [ const routes: Routes = [
{ {
path: 'login', path: 'login',
component: LoginPage component: LoginPage
}, },
{ {
path: 'tabs', path: 'tabs',
loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule) loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
}, },
{ {
path: 'tabsUser', path: 'tabsUser',
loadChildren: () => import('./tabs-user/tabs-user.module').then(m => m.TabsUserPageModule) loadChildren: () => import('./tabs-user/tabs-user.module').then(m => m.TabsUserPageModule)
}, },
{ {
path: 'view-evento', path: 'view-evento',
loadChildren: () => import('./view-evento/view-evento.module').then( m => m.ViewEventoPageModule) loadChildren: () => import('./view-evento/view-evento.module').then( m => m.ViewEventoPageModule)
}, },
{ {
path: 'galeriamodal', path: 'galeriamodal',
loadChildren: () => import('./galeriamodal/galeriamodal.module').then( m => m.GaleriamodalPageModule) loadChildren: () => import('./galeriamodal/galeriamodal.module').then( m => m.GaleriamodalPageModule)
}, },
{ {
path:'', path:'',
redirectTo: 'login', redirectTo: 'login',
pathMatch: 'full' pathMatch: 'full'
}, },
{ {
path: 'tabs-user', path: 'tabs-user',
loadChildren: () => import('./tabs-user/tabs-user.module').then( m => m.TabsUserPageModule) loadChildren: () => import('./tabs-user/tabs-user.module').then( m => m.TabsUserPageModule)
}, {
path: 'feed',
loadChildren: () => import('./feed/feed.module').then( m => m.FeedPageModule)
}, },
];
@NgModule({ ];
imports: [ @NgModule({
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) imports: [
], RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
exports: [RouterModule] ],
}) exports: [RouterModule]
export class AppRoutingModule {} })
export class AppRoutingModule {}

View File

@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FeedPage } from './feed.page';
const routes: Routes = [
{
path: '',
component: FeedPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class FeedPageRoutingModule {}

View File

@ -1,3 +0,0 @@
<p>
feed works!
</p>

View File

@ -1,14 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-feed',
templateUrl: './feed.component.html',
styleUrls: ['./feed.component.scss'],
})
export class FeedComponent implements OnInit {
constructor() { }
ngOnInit() {}
}

View File

@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { FeedPageRoutingModule } from './feed-routing.module';
import { FeedPage } from './feed.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
FeedPageRoutingModule
],
declarations: [FeedPage]
})
export class FeedPageModule {}

View File

@ -0,0 +1,33 @@
<ion-header>
<ion-toolbar>
<ion-title>Eventos Próximos</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-grid>
<ion-row>
<ion-col size="12">
<div *ngIf="eventos.length>0" class="eventos">
<ion-list>
<ion-item *ngFor="let evento of eventos" button (click)="mostrarEvento(evento)">
<div class="evento">
<div class="eventoHeader">
{{evento.nombre}} ·
<ion-icon name="calendar-outline"></ion-icon>
{{evento.fecha}} ·
<ion-icon name="cash-outline"></ion-icon>
{{evento.precio1}},{{evento.precio2}}
<ion-button (click)="editarEvento(evento);$event.stopPropagation();"><ion-icon name="pencil-outline"></ion-icon></ion-button>
</div>
<div class="eventoDesc">
{{evento.descripcion}}
</div>
</div>
</ion-item>
</ion-list>
</div>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>

View File

@ -1,19 +1,19 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
import { FeedComponent } from './feed.component'; import { FeedPage } from './feed.page';
describe('FeedComponent', () => { describe('FeedPage', () => {
let component: FeedComponent; let component: FeedPage;
let fixture: ComponentFixture<FeedComponent>; let fixture: ComponentFixture<FeedPage>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ FeedComponent ], declarations: [ FeedPage ],
imports: [IonicModule.forRoot()] imports: [IonicModule.forRoot()]
}).compileComponents(); }).compileComponents();
fixture = TestBed.createComponent(FeedComponent); fixture = TestBed.createComponent(FeedPage);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
})); }));

20
src/app/feed/feed.page.ts Normal file
View File

@ -0,0 +1,20 @@
import { Component, OnInit } from '@angular/core';
import { Eventoi } from '../interfaces/eventoi';
import { FeedService } from '../services/feed.service';
@Component({
selector: 'app-feed',
templateUrl: './feed.page.html',
styleUrls: ['./feed.page.scss'],
})
export class FeedPage implements OnInit {
eventos: Eventoi[];
constructor(private feedService:FeedService) { }
ngOnInit() {
this.eventos = this.feedService.eventos;
}
}

View File

@ -6,7 +6,7 @@
<ion-content> <ion-content>
<span>Usuario: </span><input type="text" id="username"> <span>Usuario: </span><input type="text" id="username">
<span>Contraseña: </span><input type="text" id="password"> <span>Contraseña: </span><input type="password" id="password">
<ion-button (click)="login()"> <ion-button (click)="login()">
Login Login
</ion-button> </ion-button>

View File

@ -1,11 +1,12 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { FeedPage } from '../feed/feed.page';
import { Tab2Page } from './tab2.page'; import { Tab2Page } from './tab2.page';
const routes: Routes = [ const routes: Routes = [
{ {
path: '', path: '',
component: Tab2Page, component: FeedPage,
} }
]; ];

View File

@ -1,33 +0,0 @@
<ion-header>
<ion-toolbar>
<ion-title>Eventos Próximos</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-grid>
<ion-row>
<ion-col size="12">
<div *ngIf="eventos.length>0" class="eventos">
<ion-list>
<ion-item *ngFor="let evento of eventos" button (click)="mostrarEvento(evento)">
<div class="evento">
<div class="eventoHeader">
{{evento.nombre}} ·
<ion-icon name="calendar-outline"></ion-icon>
{{evento.fecha}} ·
<ion-icon name="cash-outline"></ion-icon>
{{evento.precio1}},{{evento.precio2}}
<ion-button (click)="editarEvento(evento);$event.stopPropagation();"><ion-icon name="pencil-outline"></ion-icon></ion-button>
</div>
<div class="eventoDesc">
{{evento.descripcion}}
</div>
</div>
</ion-item>
</ion-list>
</div>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>

View File

@ -9,11 +9,11 @@ import { FeedService } from '../services/feed.service';
}) })
export class Tab2Page implements OnInit{ export class Tab2Page implements OnInit{
eventos: Eventoi[];
constructor(private feedService: FeedService) {} constructor() {}
ngOnInit(){ ngOnInit(){
this.eventos = this.feedService.eventos;
} }
} }