Skip to content

Conversation

@fathorMB
Copy link

@fathorMB fathorMB commented Nov 12, 2019

Add version label next to title

Closes issue #2

I used the "version" property in package.json, able to reach it by setting the "resolveJsonModule" property to true in tsconfig.json.

@@ -1,5 +1,5 @@
<div class="d-md-flex justify-content-between align-items-center">
<h1 class="h3"><img src="assets/redis-white.png" />{{title}}</h1>
<h1 class="h3"><img src="assets/redis-white.png" />{{title}} {{version}}</h1>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include the version string interpolation inside a tag, please?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean something like this?

<h1 class="h3"><img src="assets/redis-white.png" />{{title + ' ' + version}}</h1>

@@ -1,4 +1,5 @@
import { Component, ChangeDetectorRef, AfterViewInit } from '@angular/core';
import { version } from '../../../../../package.json';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to move this import into the environment files and use it throughout the application.
Thank you so much!

})
export class HeaderComponent implements AfterViewInit {
title = 'Redis Patterns';
version = version;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import from the environment, please. :)

@@ -1,5 +1,5 @@
<div class="d-md-flex justify-content-between align-items-center">
<h1 class="h3"><img src="assets/redis-white.png" />{{title}} {{version}}</h1>
<h1 class="h3"><img src="assets/redis-white.png" />{{title + ' ' + version}}</h1>
Copy link
Member

@fsciuti fsciuti Nov 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fathorMB , i suggest a solution as:
<h1 class="h3"><img src="assets/redis-white.png" />{{title}} <span class="h6">{{version}}</span></h1>

What do you think about it?

@@ -1,5 +1,5 @@
import { Component, ChangeDetectorRef, AfterViewInit } from '@angular/core';
import { version } from '../../../../../package.json';
import { environment } from '../../../../environments/environment';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May you use @app shortcut?

Copy link
Author

@fathorMB fathorMB Nov 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you use that given that we are at the same directory level for environments and app? Sorry but never used it and i was wondering how this can be achieved in this scenario :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use: @app/../environments/environment'; ;)

},
cacheableHeaderKey: 'cacheable-request'
cacheableHeaderKey: 'cacheable-request',
version: version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may use the property value shorthand and write only version. ;)

},
cacheableHeaderKey: 'cacheable-request'
cacheableHeaderKey: 'cacheable-request',
version: version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may use the property value shorthand and write only version. ;)

@fsciuti fsciuti changed the base branch from master to develop November 13, 2019 13:21
@fsciuti fsciuti merged commit 3d881e9 into acadevmy:develop Nov 13, 2019
@fathorMB fathorMB deleted the feature/title-version-label branch November 13, 2019 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants