Skip to content

Instantly share code, notes, and snippets.

View azaharafernandezguizan's full-sized avatar

Azahara Fernández Guizán azaharafernandezguizan

View GitHub Profile
@azaharafernandezguizan
azaharafernandezguizan / app.ts
Created October 27, 2018 06:26
Aurelia Routing example
import {RouterConfiguration, Router} from 'aurelia-router';
import {PLATFORM} from 'aurelia-pal';
export class App {
router: Router;
configureRouter(config: RouterConfiguration, router: Router): void {
this.router = router;
config.title = 'Aurelia';
config.map([
@azaharafernandezguizan
azaharafernandezguizan / app.html
Created October 27, 2018 06:29
Aurelia navigation menu example
<template>
<require from="./styles.css"></require>
<div class="menu">
<ul repeat.for="nav of router.navigation">
<li class="${nav.isActive ? 'active menuButtons' : 'menuButtons'}"><a class="menuLink" href.bind="nav.href">${nav.title}</a></li>
</ul>
</div>
<div class="mainContent">
@azaharafernandezguizan
azaharafernandezguizan / IgNobel.ts
Created October 27, 2018 06:47
Aurelia model class example
export class IgNobel {
IgNobleID: number;
Categoria: string;
Descripcion: string;
Anio: string;
constructor(IgNobleID: number, Categoria: string, Descripcion: string,
Anio: string) {
this.IgNobleID = IgNobleID;
this.Categoria = Categoria;
@azaharafernandezguizan
azaharafernandezguizan / IgNobel-Service.ts
Created October 27, 2018 06:50
Example of Aurelia Service connecting Web API
import { IgNobel } from './../models/IgNobel';
import { inject, NewInstance } from 'aurelia-framework';
import {HttpClient} from 'aurelia-http-client';
@inject(NewInstance.of(IgNobel))
export class IgNobelService {
private http: HttpClient = null;
public data : IgNobel[];
constructor() {
@azaharafernandezguizan
azaharafernandezguizan / fun.html
Created October 27, 2018 06:51
Example of Aurelia view
<template>
<div show.bind = "igNobelRandomList.length >0" class="IgNobelDiv">
<div repeat.for="igNobel of igNobelRandomList" class="igNobelList ${igNobel.categoria}">
<span>${igNobel.anio}</span><br/>
<span class="igNobelCategoria">${igNobel.categoria}</span><br/>
<span>${igNobel.descripcion}</span><br/>
</div>
</div>
<button click.delegate = "moreIgNobel()">Más IgNobels</button>
@azaharafernandezguizan
azaharafernandezguizan / fun.ts
Created October 27, 2018 06:53
Example of component file in Aurelia
import { IgNobel } from './models/IgNobel';
import { inject } from 'aurelia-framework';
import { IgNobelService } from './services/IgNobel-service';
@inject(IgNobelService)
export class Fun {
igNobelService : IgNobelService;
igNobelRandomList : IgNobel[];
igNobelTotalData: IgNobel[];
@azaharafernandezguizan
azaharafernandezguizan / Styles.css
Created October 27, 2018 06:56
Example of simple css for Aurelia
/**Fun content**/
.igNobelList{
margin: 1.5%;
padding:1%;
border-radius: 19px 19px 19px 19px;
-moz-border-radius: 19px 19px 19px 19px;
-webkit-border-radius: 19px 19px 19px 19px;
border: 0px solid #000000;
}
@azaharafernandezguizan
azaharafernandezguizan / magical.lessons.resolver.ts
Created November 3, 2018 15:37
Example of Angular Route Resolver
import { Injectable, } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
import { Observable } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { RoomDetail } from 'src/app/_models/rooms.model';
import { RoomService } from 'src/app/_services/room.service';
@Injectable()
export class MagicalLessonsResolver implements Resolve<RoomDetail> {
constructor(
@azaharafernandezguizan
azaharafernandezguizan / magical.lessons.route.ts
Created November 3, 2018 15:40
Example of Angular´s component route.
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { MagicalLessonsListComponent } from './magical.lessons.list.component';
import { MagicaLessonsComponent } from './magical.lessons.component';
import { MagicalLessonsResolver } from './magical.lessons.resolver';
const routes: Routes = [
{
path: '',
component: MagicalLessonsListComponent
@azaharafernandezguizan
azaharafernandezguizan / magical.lessons.module.ts
Created November 3, 2018 15:42
Example of Angular´s component module
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule} from '@angular/forms';
import { MagicaLessonsComponent } from './magical.lessons.component';
import { MagicalLessonsListComponent } from './magical.lessons.list.component';
import { MagicalLessonsResolver } from './magical.lessons.resolver';
@NgModule({
imports: [
CommonModule,