Angular: Custom Event
http://angularjs.org/
by Freewind
HTML
<script src="http://code.angularjs.org/angular-1.0.0rc8.js"></script>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<html ng-app="myapp">
<body ng-controller="Controller">
<button ng-click="myevent()">Trigger event</button>
[{{name}}]
</body>
</html>
CSS
textarea {
border: 0 none white;
overflow: hidden;
padding: 0;
outline: none;
background-color: lightgray;
height: 200px;
}
JavaScript
var myapp = angular.module('myapp',[]);
function Controller($scope,$element) {
$scope.myevent = function() {
jQuery($element).trigger('myevent');
}
jQuery($element).bind('myevent', hello);
function hello() {
$scope.name = "Hello";
}
}