jsp
This commit is contained in:
10
src/app/app-routing.module.ts
Normal file
10
src/app/app-routing.module.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
const routes: Routes = [];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
0
src/app/app.component.css
Normal file
0
src/app/app.component.css
Normal file
6
src/app/app.component.html
Normal file
6
src/app/app.component.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<div style="text-align:center">
|
||||
<h1>
|
||||
{{ title }}!
|
||||
</h1>
|
||||
</div>
|
||||
<app-my-component></app-my-component>
|
||||
35
src/app/app.component.spec.ts
Normal file
35
src/app/app.component.spec.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterModule.forRoot([])
|
||||
],
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'pokedemo'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('pokedemo');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, pokedemo');
|
||||
});
|
||||
});
|
||||
11
src/app/app.component.ts
Normal file
11
src/app/app.component.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrl: './app.component.css'
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'pokedemo';
|
||||
}
|
||||
25
src/app/app.module.ts
Normal file
25
src/app/app.module.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { MyComponentComponent } from './my-component/my-component.component';
|
||||
import { FilterPokemonPipePipe } from './filter-pokemon--pipe.pipe';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
MyComponentComponent,
|
||||
FilterPokemonPipePipe
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
FormsModule,
|
||||
AppRoutingModule
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
8
src/app/filter-pokemon--pipe.pipe.spec.ts
Normal file
8
src/app/filter-pokemon--pipe.pipe.spec.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { FilterPokemonPipePipe } from './filter-pokemon--pipe.pipe';
|
||||
|
||||
describe('FilterPokemonPipePipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new FilterPokemonPipePipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
||||
12
src/app/filter-pokemon--pipe.pipe.ts
Normal file
12
src/app/filter-pokemon--pipe.pipe.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'filterPokemonPipe'
|
||||
})
|
||||
export class FilterPokemonPipePipe implements PipeTransform {
|
||||
|
||||
transform(value: unknown, ...args: unknown[]): unknown {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
0
src/app/my-component/my-component.component.css
Normal file
0
src/app/my-component/my-component.component.css
Normal file
14
src/app/my-component/my-component.component.html
Normal file
14
src/app/my-component/my-component.component.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<input [(ngModel)]="id">
|
||||
|
||||
<input readonly [(ngModel)]="id">
|
||||
|
||||
<BR>
|
||||
id : {{id}}
|
||||
|
||||
|
||||
<select [(ngModel)]="selectedPokeId">
|
||||
<option [value]="poke.id" *ngFor="let poke of pokes"> {{poke.name}}</option>
|
||||
</select>
|
||||
<ul>
|
||||
<li *ngFor="let poke of pokes; index as i">{{poke.name}}</li>
|
||||
</ul>
|
||||
23
src/app/my-component/my-component.component.spec.ts
Normal file
23
src/app/my-component/my-component.component.spec.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MyComponentComponent } from './my-component.component';
|
||||
|
||||
describe('MyComponentComponent', () => {
|
||||
let component: MyComponentComponent;
|
||||
let fixture: ComponentFixture<MyComponentComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [MyComponentComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(MyComponentComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
29
src/app/my-component/my-component.component.ts
Normal file
29
src/app/my-component/my-component.component.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Component } from '@angular/core';
|
||||
//import { constructor } from 'jasmine';
|
||||
import { Pokemon } from '../pokemon';
|
||||
|
||||
@Component({
|
||||
selector: 'app-my-component',
|
||||
templateUrl: './my-component.component.html',
|
||||
styleUrl: './my-component.component.css'
|
||||
})
|
||||
export class MyComponentComponent {
|
||||
id: string;
|
||||
selectedPokeId : string;
|
||||
|
||||
pokes : Pokemon[] = [];
|
||||
|
||||
constructor(){
|
||||
this.pokes.push(new Pokemon('2', "Herbizarre"));
|
||||
this.pokes.push(new Pokemon('3', "Florizarre"));
|
||||
this.pokes.push(new Pokemon('4', "Salamèche"));
|
||||
this.pokes.push(new Pokemon('5', "Reptincel"));
|
||||
this.pokes.push(new Pokemon('6', "Dracaufeu"));
|
||||
this.pokes.push(new Pokemon('7', "Carapute"));
|
||||
this.pokes.push(new Pokemon('8', "Carabaffe"));
|
||||
this.pokes.push(new Pokemon('9', "Tortank"));
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
}
|
||||
7
src/app/pokemon.spec.ts
Normal file
7
src/app/pokemon.spec.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Pokemon } from './pokemon';
|
||||
|
||||
describe('Pokemon', () => {
|
||||
it('should create an instance', () => {
|
||||
//expect(new Pokemon("1","test")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
7
src/app/pokemon.ts
Normal file
7
src/app/pokemon.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export class Pokemon {
|
||||
|
||||
|
||||
constructor(public id:string, public name:string){
|
||||
}
|
||||
|
||||
}
|
||||
13
src/index.html
Normal file
13
src/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Pokedemo</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
10
src/main.ts
Normal file
10
src/main.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule, {
|
||||
ngZoneEventCoalescing: true
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
|
||||
1
src/styles.css
Normal file
1
src/styles.css
Normal file
@@ -0,0 +1 @@
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
Reference in New Issue
Block a user