-
Notifications
You must be signed in to change notification settings - Fork 49
feat(header): added application version label next to the title #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(header): added application version label next to the title #7
Conversation
Add version label next to title Closes issue acadevmy#2
| @@ -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> | |||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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'; | |||
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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> | |||
There was a problem hiding this comment.
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'; | |||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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'; ;)
src/environments/environment.ts
Outdated
| }, | ||
| cacheableHeaderKey: 'cacheable-request' | ||
| cacheableHeaderKey: 'cacheable-request', | ||
| version: version |
There was a problem hiding this comment.
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. ;)
src/environments/environment.prod.ts
Outdated
| }, | ||
| cacheableHeaderKey: 'cacheable-request' | ||
| cacheableHeaderKey: 'cacheable-request', | ||
| version: version |
There was a problem hiding this comment.
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. ;)
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.