just using model in the html

This commit is contained in:
Drew Ansbacher
2021-06-24 11:02:02 -06:00
committed by Aiden McClelland
parent 41d2c49bd6
commit 44af3fe781
2 changed files with 6 additions and 9 deletions

View File

@@ -8,10 +8,10 @@
</ion-header> </ion-header>
<ion-content> <ion-content>
<ion-spinner *ngIf="!releaseNotes; else loaded" class="center" name="lines" color="warning"></ion-spinner> <ion-spinner *ngIf="!releaseNotesModel.releaseNotes; else loaded" class="center" name="lines" color="warning"></ion-spinner>
<ng-template #loaded> <ng-template #loaded>
<div *ngFor="let note of releaseNotes | keyvalue : asIsOrder"> <div *ngFor="let note of releaseNotesModel.releaseNotes | keyvalue : asIsOrder">
<ion-button (click)="setSelected(note.key)" expand="full" color="light" style="height: 50px;" > <ion-button (click)="setSelected(note.key)" expand="full" color="light" style="height: 50px;" >
<p style="position: absolute; left: 10px;">{{note.key | displayEmver}}</p> <p style="position: absolute; left: 10px;">{{note.key | displayEmver}}</p>
</ion-button> </ion-button>

View File

@@ -11,20 +11,17 @@ import { ReleaseNoteModel } from './release-notes.model'
export class ReleaseNotes { export class ReleaseNotes {
error = '' error = ''
pkgId: string pkgId: string
releaseNotes: { [version: string]: string}
selected: string selected: string
constructor ( constructor (
private readonly route: ActivatedRoute, private readonly route: ActivatedRoute,
private readonly apiService: ApiService, private readonly apiService: ApiService,
private releaseNoteModel: ReleaseNoteModel, public releaseNotesModel: ReleaseNoteModel,
) { ) { }
this.releaseNotes = releaseNoteModel.releaseNotes
}
ngOnInit () { ngOnInit () {
this.pkgId = this.route.snapshot.paramMap.get('pkgId') this.pkgId = this.route.snapshot.paramMap.get('pkgId')
if (!this.releaseNotes) { if (!this.releaseNotesModel.releaseNotes) {
this.getReleaseNotes() this.getReleaseNotes()
} }
} }
@@ -32,7 +29,7 @@ export class ReleaseNotes {
async getReleaseNotes (version?: string): Promise<void> { async getReleaseNotes (version?: string): Promise<void> {
try { try {
const pkg = await this.apiService.getAvailableShow({ id: this.pkgId, version }) const pkg = await this.apiService.getAvailableShow({ id: this.pkgId, version })
this.releaseNotes = pkg['release-notes'] this.releaseNotesModel.releaseNotes = pkg['release-notes']
} catch (e) { } catch (e) {
console.error(e) console.error(e)
this.error = e.message this.error = e.message