Skip to content

Instantly share code, notes, and snippets.

@Drvanon
Created November 27, 2013 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Drvanon/7674189 to your computer and use it in GitHub Desktop.
Save Drvanon/7674189 to your computer and use it in GitHub Desktop.
var app = angular.module('twitterApp', []);
app.directive("enter", function (){
return function (scope, element, attrs) {
element.bind('mouseenter', function (){
scope.$apply(attrs.enter);
})
}
});
app.controller('AppCtrl', function ($scope) {
$scope.show = "";
$scope.loadMoreTweets = function () {
$scope.show = "Test";
console.log('trigger');
};
});
<!DOCTYPE html>
<html>
<head>
<title>Behaviour</title>
</head>
<body>
<div ng-app='twitterApp'>
<div ng-controller='AppCtrl'>
<div enter='loadMoreTweets()'>Roll over to load more tweets {{ show }}</div>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script src="behaviour.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment