Created
January 5, 2014 16:45
-
-
Save mdonkers/8270527 to your computer and use it in GitHub Desktop.
AngularJS Directives - Using value in HTML attribute directly instead of needing to store on $scope.
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
myApp.directive('statsList', function () { | |
return { | |
restrict: 'E', | |
scope: { | |
items: '=listType', | |
orderBy: '@' | |
}, | |
templateUrl: 'partials/partial1.html' | |
}; | |
}); |
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
<stats-list list-type="topDuration" order-by="duration"></stats-list> | |
<stats-list list-type="latest" order-by="start"></stats-list> |
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
<table class="table table-condensed"> | |
<thead> | |
<tr> | |
<th>Sensor Id</th> | |
<th>Start</th> | |
<th>Duration</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr ng-repeat="item in items | orderBy:'value.' + orderBy:reverse=true"> | |
<td>{{item.value.sensorId}}</td> | |
<td>{{item.value.start | date:'dd/MM @ H:mm'}}</td> | |
<td>{{item.value.duration | msToSec | number | secAppendix}}</td> | |
</tr> | |
</tbody> | |
</table> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment