arielfaur / ionic-audio

An audio player for Ionic 3 and Angular 4. Works with HTML 5 audio or native audio using Cordova Media plugin.
http://arielfaur.github.io/ionic-audio/2.0/index.html
MIT License
321 stars 163 forks source link

can't bind to track since it isn't a known property of audio-track. if ... [using lazy loading in ionic 3] #177

Closed KadjoFamian closed 6 years ago

KadjoFamian commented 6 years ago

Hi all, i faced an issue with the plugin and struggle for 3 days. As you can read in the title, i use lazy loading in my ionic 3 project and that is why i end up in such issue. So i want to share how i solved it to spare you headache.

As you noticed, adding CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA to the module schemas array did not help.

you should add IonicAudioModule to the module of the page where you're using the audio-track tag

this is my project pages structures:

home.ts home.html home.scss home.module.ts

so in the home.module.ts, i simply added IonicAudioModule to the imports array just like the following code sample:

`import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { HomePage } from './home'; import { IonicAudioModule } from 'ionic-audio';

@NgModule({ declarations: [ HomePage, ], imports: [ IonicPageModule.forChild(HomePage), IonicAudioModule ] }) export class HomePageModule {} `

I do hope it helps

my `ionic info

ionic 3.9.2 angular 5.0.3 `

@arielfaur, please consider updating the README page

thanks for your job

arielfaur commented 6 years ago

147