This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a workspace | |
ng new devdacticMulti --createApplication=false | |
cd ./devdacticMulti | |
# Create our projects directory | |
mkdir projects |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from '@angular/core'; | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { RouteReuseStrategy } from '@angular/router'; | |
import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; | |
import { SplashScreen } from '@ionic-native/splash-screen/ngx'; | |
import { StatusBar } from '@ionic-native/status-bar/ngx'; | |
import { AppComponent } from './app.component'; | |
import { AppRoutingModule } from './app-routing.module'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ionic start devdacticPokedex blank | |
cd devdacticPokedex | |
ionic g page details | |
ionic g service services/pokemon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-header> | |
<ion-toolbar color="primary"> | |
<ion-buttons slot="start"> | |
<ion-back-button defaultHref="home"></ion-back-button> | |
</ion-buttons> | |
<ion-title class="ion-text-capitalize">{{ details?.name }}</ion-title> | |
</ion-toolbar> | |
</ion-header> | |
<ion-content> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PokemonService } from './../services/pokemon.service'; | |
import { Component, OnInit } from '@angular/core'; | |
import { ActivatedRoute } from '@angular/router'; | |
@Component({ | |
selector: 'app-details', | |
templateUrl: './details.page.html', | |
styleUrls: ['./details.page.scss'], | |
}) | |
export class DetailsPage implements OnInit { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-header> | |
<ion-toolbar color="primary"> | |
<ion-title> | |
Devdactic Pokemon | |
</ion-title> | |
</ion-toolbar> | |
</ion-header> | |
<ion-content> | |
<ion-searchbar placeholder="Search Pokemon" (ionChange)="onSearchChange($event)"></ion-searchbar> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PokemonService } from './../services/pokemon.service'; | |
import { Component, OnInit, ViewChild } from '@angular/core'; | |
import { IonInfiniteScroll } from '@ionic/angular'; | |
@Component({ | |
selector: 'app-home', | |
templateUrl: 'home.page.html', | |
styleUrls: ['home.page.scss'], | |
}) | |
export class HomePage implements OnInit { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { map } from 'rxjs/operators'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class PokemonService { | |
baseUrl = 'https://pokeapi.co/api/v2'; | |
imageUrl = 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--ion-color-primary: #DC0A2C; | |
--ion-color-primary-rgb: 220,10,44; | |
--ion-color-primary-contrast: #ffffff; | |
--ion-color-primary-contrast-rgb: 255,255,255; | |
--ion-color-primary-shade: #c20927; | |
--ion-color-primary-tint: #e02341; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from '@angular/core'; | |
import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; | |
const routes: Routes = [ | |
{ path: '', redirectTo: 'home', pathMatch: 'full' }, | |
{ path: 'home', loadChildren: './home/home.module#HomePageModule' }, | |
{ path: 'home/:index', loadChildren: './details/details.module#DetailsPageModule' }, | |
]; | |
@NgModule({ |