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-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>
<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;" >
<p style="position: absolute; left: 10px;">{{note.key | displayEmver}}</p>
</ion-button>

View File

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