Yes, that’s exactly what I would say more concisely if Discourse didn’t have a character minimum.
Diagnostic not working
Ion-list is not supported on ios devices in Ionic 4
Okay. I also did as you said. Only the subscriptions are done in the ngOnInit andin ionViewWillEnter. Not the initialization.
And I cannot make any sense since it is working on Android devices and in browsers.
At the declaration time:
my_days: string[]=[]
Ion-list is not supported on ios devices in Ionic 4
Please attach a debugger to the device and look in the JavaScript console. There is likely more information there.
How to stop media plugin audio when navigating away from a page
Hello, I am playing audios in an ionic app with cordova media plugin.
so, when users navigate a way from the audio page, I want the audio to stop because it’s causing an unexpected behaviour that allows users to play multiple audios at the same time thereby causing overlap of audios .
This is what I have tried that did not work
ngOnDestroy(): void {
if(this.Audiofile){
//this.Audiofile.stop()
this.Audiofile.release()
}
}
ionViewDidLeave(){
if(this.Audiofile){
//this.Audiofile.stop()
this.Audiofile.release()
}
}
ionViewWillLeave(){
if(this.Audiofile){
//this.Audiofile.stop()
this.Audiofile.release()
}
}
How to text-overflow: ellipsis inside ion-item?
If you don’t get any better answers, you could do the truncation manually as a property of the object. Incidentally, never call functions from inside {{}}
interpolated expressions (or anything else that gets displayed in a template). Just reference properties. This is because Angular’s change detection can know when a property changes, but it can’t know when a function will return something different, so it must call it needlessly zillions of times.
How to stop media plugin audio when navigating away from a page
Are you using tabs, by any chance?
How to stop media plugin audio when navigating away from a page
Thank you, yes I am using tabs
How to stop media plugin audio when navigating away from a page
Then you’re going to have to listen for tab changes on the <ion-tabs>
. Its children are cached - they don’t get destroyed.
How to stop media plugin audio when navigating away from a page
Thank you, any hint on how to go about that ?
[best practice] Chained API requests
Thanks for a lot for your answers.
But I’m sorry I don’t understand everything :
That’s what I was thinking I will try to do it this way.
In my example is quiet simplified but I think you’r right I can reduce the number of relation between tables.
Then :
-
no any
- I agree but I didn’t implement the class yet and I still make some changes on my tables/classes.
-
everything is functional, no external state (this means that inside getPosts, this is read-only)
- that’s difficult to implement, so if I understand, in my example, I return everything and it’s only in my component that I create the “myPrintedObject” ?
-
no nested subscriptions
- That’s exactly what’s disgust me, but I need to wait for the first response in order to execute the second request. This is the only way I found to achieve that. I saw your example and I already try something like that but I can’t manage to have two
mergeMap
(in the case you have 3 API calls to make).
- That’s exactly what’s disgust me, but I need to wait for the first response in order to execute the second request. This is the only way I found to achieve that. I saw your example and I already try something like that but I can’t manage to have two
-
no subscribing in the place we generate the future (meaning no subscribe in our service at all)
- WHAT !? This time I’m completely lost … How is it possible ? Again, even in your example (post) every functions return an Observable.
- Eratum !!! You said No subscribe and not no Observable , my bad. I get it, but again it’s to be sure that I received the answer before executing the next request.
Thanks for your help again !!!
How to stop media plugin audio when navigating away from a page
onTabChange() {
}
?
[best practice] Chained API requests
In that case, I would urge you to rename the columns away from snake_case
and into camelCase
(or do this in the REST middleware app, which is what I do).
No, that gets generated in the service. What I’m asking you to get away from is the imperative style of this.loadedPosts.push
. Forcing yourself to write getPosts
in a strictly functional style will make use of RxJS operators much more natural.
forkJoin
is our friend here.
interface PostStub {
id: string;
authorId: string;
photoId: string;
instituteId: string;
}
interface Post {
id: string;
author: Author;
photo: Photo;
institute: Institute;
}
fetchPostStub(id: string): Observable<PostStub> {...}
fetchAuthor(id: string): Observable<Author> {...}
fetchPhoto(id: string): Observable<Photo> {...}
fetchInstitute(id: string): Observable<Institute> {...}
fleshOutPost(stub: PostStub): Observable<Post> {
return forkJoin([this.fetchAuthor(stub.authorId),
this.fetchPhoto(stub.photoId),
this.fetchInstitute(stub.instituteId)]).pipe(
map(([author, photo, institute]) => {
return { id: stub.id, author, photo, institute };
});
}
fetchPost(id: string): Observable<Post> {
return this.fetchPostStub(id).pipe(
mergeMap(stub => this.fleshOutPost(stub));
}
I think of producers and consumers. Consumers (components, usually) are the places where subscribe
should happen. Producers (the service) returns the Observable
, but does not ever subscribe
to it. What you are doing with subscribe
can be done with mergeMap
.
Ion-list is not supported on ios devices in Ionic 4
The problem was in date format of the api. It has nothing to do with ionic. Just that ios platforms cannot transform dates type of string in ISO format to Date object.
I am sorry for my fault. Thanks so much for the help.
Geolocation is not working on Android devices, although it work on ios
Someone any idea? I debugged the app and it does not even access the function getCurrentPosition() of the object geolocation.
[best practice] Chained API requests
Love what I see !
As you can imagine I have some difficulties with RxJS operators and I realize now that it can’t be. I need to work on that.
Ok I think I can manage to implement your code I understand the idea.
But now, you make me hesitate, do I modify the API to deliver directly the necessary values or I make the forkJoin calls.
I think, I will first try to modify the API and then I will try to follow your best practices for the Ionic part.
Will do right now, besides I knew it
Thanks a LOT !
I will keep you up to date when I fixed the issue.
Geolocation is not working on android
have the same problem. did u find any solution?
How to determine if browser or app
For some reason my app that was using the solution below has stopped working:
isApp(): boolean {
return (document.URL.indexOf('http') !== 0 || document.URL.indexOf('http://localhost:8080') === 0);
}
Now I´m using your solution @ Unkn0wn0x and it works propertly, thank you so much!
How to pass query params or use child/nested routes in tabs?
Hi,
I am having trouble figuring out how to have tabs that point to nested routes, or how to pass query parameters through the URL in Ionic 4 + Angular.
If I have tab routes like:
export const routes: Routes = [
{
path: 'tabs',
component: TabsPage,
children: [
{
path: 'posts',
children: [
{
path: '',
loadChildren: '../posts/posts.module#PostsModule'
}
]
},
{
path: 'users',
children: [
{
path: '',
loadChildren: '../users/users.module#UsersModule'
}
]
}
]
}
]
and tabs.html:
<ion-tabs>
<ion-tab-bar slot="bottom">
<ion-tab-button tab="posts">
<ion-label>Posts</ion-label>
</ion-tab-button>
<ion-tab-button tab="users">
<ion-label>Posts</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
it all works as expected. However I am looking to achieve something like this:
<ion-tabs>
<ion-tab-bar slot="bottom">
<ion-tab-button tab="posts/123">
<ion-label>Post X</ion-label>
</ion-tab-button>
<ion-tab-button tab="posts/456">
<ion-label>Post Y</ion-label>
</ion-tab-button>
<ion-tab-button tab="users/789">
<ion-label>User Z</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
In this instance the tab will load, however the tab label and icon will not be styled as being the active tab.
If I do the following:
<ion-tabs>
<ion-tab-bar slot="bottom">
<ion-tab-button tab="posts" [routerLink]="['posts', 123]">
<ion-label>Post X</ion-label>
</ion-tab-button>
<ion-tab-button tab="users" [routerLink]="['users', 456]">
<ion-label>User Y</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
The posts/123
page will flash briefly, be being replaced with posts
page.
The href
attribute described in the Ionic documentation appears to do nothing.
Thanks.
Ionic 4 android 9 CLEARTEXT http not permitted error
Thanks, this works for me!
Ionic 4 add text to image and download
Hi,
I want add text to images and download via my ionic app. Does anyone know how to do it?