Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49308

Good practices static ion-select

$
0
0

@takugian wrote:

Hello, ionic devs!

I have following :

Playstation 4 Xbox One Switch Etc

When I have a static list and I need to repeat the component in other Pages, what is the best practice to avoid duplication of Code?

Well, When I say duplication is both HTML and TypeScript.

I could create a new component called , but what about the TypeScript? Can I create a const with The values and export It?

Export const CONSOLE = {
playStation4 = ‘Playstation 4’, etc
}

But doing this, How can I import The labels to HTML?

So, I want to avoid duplication of labels too. In Java, I could create a enum for example. If I need to add a New console, I Just need to change the enum, because all enums have a values() method that returns a list of constants.

I need same good practice in Ionic. What should I do?

Thanks, ionic devs!!!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49308

Trending Articles



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