Last active
August 29, 2015 14:08
-
-
Save srfrnk/b808512b6b80eb36a50f to your computer and use it in GitHub Desktop.
Angular canvas directive. Demo at http://plnkr.co/edit/fMjsBr?p=preview
This file contains hidden or 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
| (function(angular) { | |
| "use strict"; | |
| angular.module("ng.canvas", []) | |
| .directive('canvas', ["$timeout", | |
| function($timeout) { | |
| return { | |
| restrict: "E", | |
| link: function(scope, elm , attrs ) { | |
| scope[attrs.context2d||"context2d"]=elm[0].getContext("2d"); | |
| $timeout(function(){scope.$eval(attrs.init||"canvasInit()")}); | |
| } | |
| }; | |
| } | |
| ]); | |
| })(angular); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment