Reputation:
I created a new Ionic app and tried to display a value from a variable in HTML but i can't get it working.
This is my page, I didn't change anything. I just created the app.
import { IonicModule } from '@ionic/angular';
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Tab1Page } from './tab1.page';
import { SongsProviderService } from '../Services/songs-provider.service';
@NgModule({
imports: [
IonicModule,
CommonModule,
FormsModule,
RouterModule.forChild([{ path: '', component: Tab1Page }])
],
declarations: [Tab1Page]
})
export class Tab1PageModule {
songs: any;
bla: any;
constructor(public songsService: SongsProviderService) {
this.bla = "sss";
console.log(this.bla);
}
}
HTML:
<ion-header>
<ion-toolbar>
<ion-title>
Tab One
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-content>
<p>Test {{bla}}</p>
</ion-content>
</ion-content>
Upvotes: 0
Views: 543
Reputation: 36
I wonder if the reason is due to the fact that are two <ion-content>
elements. This article states that there should just be one: https://ionicframework.com/docs/api/content
Upvotes: 1