Question: So I'm absolutely new to writing any type of code, I'm trying to build a simple website using AngularJS and I'm having a problem with looping through a controller's object array through a directive template. My goal is to output each array string into a separate list item element in the template,
for example in the controller I have 

```
    $scope.items = [
    {
     list: ["1", "2", "3"],
     name: "whatever"
    },
    {
     list: ["4", "5", "6", "7", "8"],
     name: "whatever2"
    }]

```

in the directive template I have written something like this

```
    <h1>{{ directive.name }}</h1>
    <ul id= "items"></ul>
    <script>
            for (var i = 0; i < directive.list[].length; i++) {
                  document.getElementById("items").innerHTML = 
                   "<li>{{" + directive.list[i] + "}}</li>";
            };
    </script>

```

the name object retrieves correctly in `index.html` using the template but list object will not output the array, gave it my best shot, tried troubleshooting to get it right and I can't seem to figure it out, need help :( hope I'm being clear enough, this is my first attempt at creating anything and still trying to get familiar with all the jargon.

Answer: 
Emoji is a Unicode symbols. Based on the Unicode character table Emoji flags consist of 26 alphabetic Unicode characters (A-Z) intended to be used to encode ISO 3166-1 alpha-2 two-letter country codes ([wiki](https://en.wikipedia.org/wiki/Regional_Indicator_Symbol)).

That means it is possible to split two-letter country code and convert each A-Z letter to regional indicator symbol letter:

```java
private String localeToEmoji(Locale locale) {
    String countryCode = locale.getCountry();
    int firstLetter = Character.codePointAt(countryCode, 0) - 0x41 + 0x1F1E6;
    int secondLetter = Character.codePointAt(countryCode, 1) - 0x41 + 0x1F1E6;
    return new String(Character.toChars(firstLetter)) + new String(Character.toChars(secondLetter));
}

```

Or in Kotlin, for example (assuming UTF-8):

```
val Locale.flagEmoji: String
    get() {
      val firstLetter = Character.codePointAt(country, 0) - 0x41 + 0x1F1E6
      val secondLetter = Character.codePointAt(country, 1) - 0x41 + 0x1F1E6
      return String(Character.toChars(firstLetter)) + String(Character.toChars(secondLetter))
    }

```

Where `0x41` represents uppercase `A` letter and `0x1F1E6` is `REGIONAL INDICATOR SYMBOL LETTER A` in the Unicode table.

**Note:** This code example is simplified and doesn't have required checks related to country code, that could be not available inside the locale.
You can get the country code very simple.
I want to talk about flag selection according to country code.

I wrote a class about it and it is very simple to use.

usage: 

```
String countryWithFlag = CountryFlags.getCountryFlagByCountryCode("TR") + " " + "Türkiye";

```

Output : Türkiye

You can use it with Android TextView too :)

**You can check out the class [here](https://gist.github.com/BurakDizlek/9eb54a0245a765dbdd312148f1c96d7f)**

It works very well on Android 6 and above.