Quantcast
Channel: Ionic Forum - Latest posts
Viewing all 228661 articles
Browse latest View live

Return all fields from a document as an array from Firebase cloud Firestore - ionic 4

$
0
0

It’s not TypeScript, it’s a mismatch between imperative programming (what you’re trying to do, and likely the mindset most all of us started with) and reactive/functional programming (what you need to do to survive writing webapps).

Imagine you’re the head of a large spy organization. You can’t micromanage the details of each of your agents’ missions, because you aren’t there and can’t know in advance when or if they’ll run into X or Y challenge. The best you can do is train them: “hey, if X happens to you, then you need to immediately go to the nearest safehouse”; “if you figure out the name of the enemy agent behind Y, then fire off a carrier pigeon and tell agent 99 - they’ll handle it from there”.

This is roughly the situation we’re in with reactive programming. The subscribe block is effectively your agent field manual. You have to write it in advance, but have no way of knowing when (or even if in some cases) it’ll be used. Anyplace outside the field, it’s just a book. It can’t take action on its own.

The first most crucial step you absolutely have to take here is to meticulously give every object property, function parameter, and return value a proper type (no any). You’ve already got a Quiz interface, which is excellent. However, returnQuiz doesn’t declare a return value type, and if it did, a lot of this would suddenly become crystal-clear.

The second important step is to rigorously separate methods into two types: those who produce a result (“functions”) and those who do something (“procedures”). Do your absolute best to avoid hybrids - they are responsible for many subtle and frustrating bugs.

Functions cannot modify external state

There is lots of assignment to this. things in returnQuiz. All of them need to go away if it’s a function. So does the subscribe call, because subscribing is an action, and functions don’t take actions. If you decide to go this route, you must decide what you want returnQuiz to return. Unfortunately, your first choice is likely to be Quiz, and that’s simply not possible. Ever. Really. The best you can do is Observable<Quiz>, pushing the burden of subscription to callers of returnQuiz.

Procedures must always return void

If you want returnQuiz to keep its subscribe and its assignment to controller properties, it can’t attempt to return anything (and needs a new name).

Either of those options is doable, so take some time to think about which way you want to go.


I want to download a file from my rest and save it on download folder

$
0
0

I’m using https but i have a middleware to check if session token is active, so i don’t know how to send that token using that plugin.

I'm trying to read as dataurl contact picture

$
0
0

Do you have at least version 3.0.0 of the webview plugin? This commit looks highly relevant to your situation.

I'm trying to read as dataurl contact picture

I want to download a file from my rest and save it on download folder

$
0
0

Interceptors are the easiest way, assuming we’re still using Angular HttpClient.

By “that plugin” I hope you don’t mean the file-transfer one, because I thought we’d agreed to forget it ever existed.

Cordova plugin network information not working

$
0
0

Hi Mates, I found the solution to this. It seems like network events only fire when the app is running on a device. I you would like to test with a browser, please run ionic cordova run browser :slight_smile: Happy coding from me in South Africa

I'm trying to read as dataurl contact picture

$
0
0

Weird, since your situation looks to me more or less identical to this issue, which was marked fixed by that commit. It also surprises me not to see any port 8080 in the URLs you’re getting from the ionic-webview plugin.

I'm trying to read as dataurl contact picture

$
0
0

That issue is for loading the image, i’m loading the image and showing it in an ion-img. I think like you, if the ion-img can show the image there has to be a way that i can acces to that file and read it. Httpclient is the way but is like not recognize the path to the image


Execute function with the application closed (IONIC 4)

$
0
0

Good afternoon guys, I need to run a function with the application closed. PS: I can use it in the background, but if the application is slid it doesn’t work …

Execute function with the application closed (IONIC 4)

$
0
0

This is not possible. Your “function” is Javascript Code that runs in a Webview. This isn’t available when the Application is closed.

App production

Ion-segment color change

$
0
0

Hi all,

I really like Ionic. I’m quite fast with programming everything of logic and functionality.
But honestly I have to say the Styling part of Ionic is still a huge pain in the ass for me (sorry to say :frowning: ).
It really takes so much time for me.

I think I understand the concept so far and was is written here in the documentation:


But I always have strange behaviours and a lot of things which don’t work as expected.

My problem now:

I copied the ion-segment example of the official ionic-documentation to my app (page).
Example I used: https://github.com/ionic-team/ionic-docs/blob/master/src/demos/api/segment/index.html
The colors are all still default. And also the default background color of the app is white.
In the example you see the ion-segements are using the color settings like ‘warning, danger’ and so on…
But in a slightly lighter color version which I like.

But when I change ONLY the background custom variable in variables.scss

--ion-background-color:#afca0a;

it looks like this:

You see the background-color shines anyhow through the ion-segements.
I see the same effect also on other built in ionic-components.

How can I use the background color that it has no impact on the ion-segment?

The solution should be like this:
solution

Maybe there is a simple solution, but I also want to understand it.
I don’t understand why the background color can have an impact to those ionic-components since
there are built as Web Components and should be encapsulated?

Thanks for any support
Oliver

Ionic 5 events from @ionic-angular is missing

$
0
0

thanks for the help…yes I later saw in the docuent.

App production

InAppBrowser only shows a blank screen

$
0
0

I have been having the same issues running v3.1.0.

I have worked out that is works fine with a fresh install of the app, able to do multiple open requests. Once the app is restarted we only getting the White screen on IOS 13.3.1 . If App is reinstalled it is working again.

I have change the ATS setting to allow insure connection(URL is https) and Attribute loading which has solved it in 50% of the cases. This is only on devices running IOS 13+.

Any idea on how to solve this White screen of death?


How to set image in page background in ionic 4?

$
0
0

Depending on the design of your image, you may need to change the CSS properties as how the image will size and position itself.

ERR_INVALID_ARG_TYPE when running ionic serve for first time

$
0
0

I followed this and it worked. Thanks.

App production

$
0
0

I’m trying to create an app to aid with studying but I don’t know how to do it, do you?

Hannah McKain

Business and design major 2023

Auxiliary services student worker

How to use one native function on multiple pages

$
0
0

Thanks for this. I read about services from the link you provided and I’m practicing it. I’m honestly quite new to Angular and Ionic so I know i need more practice. But do you go about reusing native plugins in the same way, or how do you usually go about reusing native?

Ionic 5 React - ionic serve fails

Viewing all 228661 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>