Created
June 4, 2015 22:39
-
-
Save javierguerrero/8eecf50b472a241a1947 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-app='app' class="filters_ct" ng-controller="selectFilter"> | |
<ul> | |
<li ng-repeat="filter in filters" ng-click="select($index)" ng-class="{sel: $index == selected}"> | |
<span class="filters_ct_status"></span> | |
{{filter.time}} | |
</li> | |
</ul> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = angular.module('app', []); | |
app.controller('selectFilter', function($scope) { | |
$scope.filters = [ | |
{ | |
'filterId': 1, | |
'time': 'last 24 hours', | |
}, | |
{ | |
'filterId': 2, | |
'time': 'all', | |
}, | |
{ | |
'filterId': 3, | |
'time': 'last hour', | |
}, | |
{ | |
'filterId': 4, | |
'time': 'today', | |
}, | |
{ | |
'filterId': 5, | |
'time': 'yersteday', | |
} | |
]; | |
$scope.selected = 0; | |
$scope.select= function(index) { | |
$scope.selected = index; | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.sel { | |
color:red | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment