Skip to content

Commit 0ce4a6e

Browse files
IsmaestroIsmael Ramos
authored andcommitted
feat(pipes): added some angular pipes like, json, number, date, etc. Added also language-service package.
1 parent 856f9f8 commit 0ce4a6e

File tree

12 files changed

+51
-7
lines changed

12 files changed

+51
-7
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Live DEMO [here](http://angularexampleapp.com/)!
6565
* CRUD: create, update and remove heroes
6666
* Custom example library
6767
* Search bar, to look for heroes
68+
* Angular Pipes
6869
* Custom loading page
6970
* Modal and toasts (snakbar)!
7071
* Unit tests with Jasmine and Karma including code coverage

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "5.2.0",
44
"license": "MIT",
55
"scripts": {
6-
"start": "ng serve",
6+
"start": "ng serve --aot",
77
"build": "ng build --prod",
88
"deploy": "ng build --prod --base-href / && angular-cli-ghpages",
99
"test": "ng test --watch=false --code-coverage",
@@ -41,6 +41,7 @@
4141
"@angular/cdk": "5.1.1",
4242
"@angular/cli": "1.6.7",
4343
"@angular/compiler-cli": "5.2.3",
44+
"@angular/language-service": "^5.2.9",
4445
"@angular/material": "5.1.1",
4546
"@angular/platform-server": "5.2.3",
4647
"@ngx-translate/core": "9.1.1",

src/app/core/footer/footer.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<span>{{ 'angularExampleApp' | translate }} 2018</span>
66
</div>
77
<div fxFlex="33" class="text-center">
8-
<sample-component [locale]="currentLang"></sample-component>
8+
{{currentDate | date:'fullDate'}}
99
</div>
1010
<div fxFlex class="text-right" class.xs="footer-xs">
1111
<a href="https://angular.io/" target="_blank"><img src="assets/images/angular.svg"></a>

src/app/core/footer/footer.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {TranslateService} from '@ngx-translate/core';
99

1010
export class FooterComponent {
1111
currentLang: string;
12+
currentDate = Date.now();
1213

1314
constructor(private translateService: TranslateService) {
1415
this.currentLang = this.translateService.currentLang;

src/app/heroes/hero-list/hero-list.component.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h3 mat-line [ngClass]="{'cp': hero.default}" (click)="seeHeroDetails(hero);"> {
1818
<span>{{hero.alterEgo}}</span>
1919
</p>
2020
<div class="hero-actions">
21-
{{hero.likes}}
21+
{{hero.likes | number:'.0'}}
2222
<mat-icon matTooltip="{{(canVote ? 'canVote' : 'cannotVote') | translate}}"
2323
[matTooltipPosition]="'above'"
2424
class="like-icon" (click)="like(hero)">
@@ -56,5 +56,10 @@ <h2 class="section-title">{{ 'createHero' | translate }}</h2>
5656
<div *ngIf="error">{{error | translate}}</div>
5757
</form>
5858
</div>
59+
60+
<div id="heroes-json">
61+
<h2 class="section-title">{{ 'firstTwoHeroesById' | translate }}</h2>
62+
<pre>{{heroes | slice:1:3 | json}}</pre>
63+
</div>
5964
</div>
6065
<div class="clear"></div>

src/app/heroes/hero-list/hero-list.component.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ form {
5050
}
5151
}
5252

53+
#heroes-json {
54+
margin-top: 2rem;
55+
56+
pre {
57+
margin-top: 1rem;
58+
}
59+
}
60+
5361
@media (max-width: 680px) {
5462
#left {
5563
width: 100%;

src/assets/css/styles.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,21 @@ snack-bar-container {
8787
.text-right {
8888
text-align: right;
8989
}
90+
91+
pre {
92+
background: #f4f4f4;
93+
border: 1px solid #ddd;
94+
border-left: 3px solid #3f51b5;
95+
color: #666;
96+
page-break-inside: avoid;
97+
font-family: monospace;
98+
font-size: 15px;
99+
line-height: 1.6;
100+
margin-bottom: 1.6em;
101+
max-width: 100%;
102+
overflow: auto;
103+
padding: 1em 1.5em;
104+
display: block;
105+
text-align: left;
106+
word-wrap: break-word;
107+
}

src/assets/i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@
4646
"heroDetail": "Hero detail",
4747
"error404": "404 Error",
4848
"mayTheForce": "May the force be with you",
49-
"updateBrowser": "You are using an old browser, please update it and reload the page."
49+
"updateBrowser": "You are using an old browser, please update it and reload the page.",
50+
"firstTwoHeroesById": "Heroes (1-2)"
5051
}

src/assets/i18n/es.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@
4646
"heroDetail": "Detalle del heroe",
4747
"error404": "Error 404",
4848
"mayTheForce": "Que la fuerza te acompañe",
49-
"updateBrowser": "Estas usando un navegador antiguo, por favor actualiza la versión y recarga la página."
49+
"updateBrowser": "Estas usando un navegador antiguo, por favor actualiza la versión y recarga la página.",
50+
"firstTwoHeroesById": "Heroes (1-2)"
5051
}

0 commit comments

Comments
 (0)