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: 
When I first wrote this answer I somehow overlooked that I've only worked on Android via React Native!

Anyway, here's my JavaScript solution that works with or without ES6 support.

```js
    function countryCodeToFlagEmoji(country) {
      return typeof String.fromCodePoint === "function"
        ? String.fromCodePoint(...[...country].map(c => c.charCodeAt() + 0x1f185))
        : [...country]
            .map(c => "\ud83c" + String.fromCharCode(0xdd85 + c.charCodeAt()))
            .join("");
    }

console.log(countryCodeToFlagEmoji("au"));
console.log(countryCodeToFlagEmoji("aubdusca"));
```

If you want to pass in the country codes as capital letters instead, just change the two offsets to `0x1f1a5` and `0xdda5`.
I was looking for that too but I don't think it's possible yet.

Have a look here:
<http://developer.android.com/reference/java/util/Locale.html>

No mentioning about flags.

\_

Alternately you can check the answer here:

[Android Countries list with flags and availability of getting iso mobile codes](https://stackoverflow.com/questions/20519675/android-countries-list-with-flags-and-availability-of-getting-iso-mobile-codes)

that might help you.