2015-12-15 5 views
1

Я хочу получить флаг страны в ярлыке страны.Как получить названия стран с их флагами в angularjs

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0-rc.0/angular.min.js"></script> 
<script src="ng-flags.js"></script> 
<script src="script.js"></script> 
<body ng-app="validationApp" ng-controller="mainController" style="background-image:url('images/Assets/BG.png')"> 
<label>COUNTRY</label><br> 
<select name="country"> 
<option ><span flag="'us'" flag-size="f32">USA</span></option></select><br><br> 
</body> 

Объявление ng-controller добавляет зависимость от ng-флага.

var validationApp = angular.module('validationApp', ['ngFlag']); 

// create angular controller 
    validationApp.controller('mainController', function($scope) { 

    // function to submit the form after all validation has occurred  



}); 

ответ

0

Предполагая, что библиотека нг-флагов вы используете этот один: https://github.com/asafdav/ng-flags

Вам просто нужно следовать инструкциям ...

Usage 

Add ng-flag.js to your main file (index.html) 

Set ngFlag as a dependency in your module 

var myapp = angular.module('myapp', ['ngFlag']) 
Add the following line to the head section of your main file 

<link rel="stylesheet" type="text/css" href="http://cloud.github.com/downloads/lafeber/world-flags-sprite/flags16.css" /> 
Start drawing flags 

<flag country="us" size="16"></flag> 

* 32x32 thumbnails are also supported, just add the following line to your head: 
<link rel="stylesheet" type="text/css" href="http://cloud.github.com/downloads/lafeber/world-flags-sprite/flags32.css" /> 
And and specify the wanted sizein your html: 

    <flag country="us" size="32"></flag> 
+0

Я последовал выше шаги, но он не сделал Работа –

Смежные вопросы