Created
September 28, 2013 09:33
-
-
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.
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
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' | |
}; | |
} ); |
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
<div my-directive></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment