Skip to content

Instantly share code, notes, and snippets.

@BrianGenisio
Last active December 30, 2015 13:39
Show Gist options
  • Save BrianGenisio/7836837 to your computer and use it in GitHub Desktop.
Save BrianGenisio/7836837 to your computer and use it in GitHub Desktop.
<div ng-click="toggle()" class="hampster-dance">
<img src="/img/hampster.jpeg" ng-show="!animated" />
<img src="/img/animated-hampster.gif" ng-show="animated" />
<embed src="/audio/hampster-dance.wav" ng-show="animated">
</div>
App.directive('hampsterDance', function() {
return {
restrict: 'EA',
controller: function($scope) {
$scope.toggle = function() {
$scope.animated = !$scope.animated;
}
},
templateUrl: '/app/directives/hampster-dance.html'
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment