Skip to content

Instantly share code, notes, and snippets.

@anddoutoi
Created September 28, 2013 09:33
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 anddoutoi/6740350 to your computer and use it in GitHub Desktop.
Save anddoutoi/6740350 to your computer and use it in GitHub Desktop.
The so called 2-way binding in AngularJS. More like lol-binding imo.
angular.directive( 'myDirective', function () {
return {
link: function ( scope, element ) {
element.on( 'click', function ( event ) {
scope.foo = 'bar';
// need to $scope.$apply here. Ugly! Should be automagic.
} );
},
restrict: 'E'
};
} );
<div my-directive></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment