Skip to content

Commit

Permalink
First version
Browse files Browse the repository at this point in the history
  • Loading branch information
asafdav committed Sep 1, 2013
1 parent 628bdb6 commit 7be9429
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "ng-flags",
"version": "0.0.1",
"dependencies": {
"angular": "~1.0.4"
},
"devDependencies": {}
}
25 changes: 25 additions & 0 deletions src/directives/ng-flags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* ng-flags module
* Turns country ISO code to flag thumbnail.
*
* Author: asafdav - https://github.com/asafdav
*/
angular.module('ngFlag', []).
directive('flag', ['$parse', function($parse) {
return {
template: '<span class="{{ flagSize }}"><span class="flag {{ country }}"></span></span>',
replace: true,
link: function(scope, elm, attrs) {
// Default flag size
scope.flagSize = 'f16';

attrs.$observe('flag', function(value) {
scope.country = scope.$eval(value).toLowerCase();
});

attrs.$observe('flagSize', function(value) {
scope.flagSize = value;
});
}
};
}]);

0 comments on commit 7be9429

Please sign in to comment.