Last active
August 29, 2015 14:06
-
-
Save benlesh/2a11d1b4d65006d6ade3 to your computer and use it in GitHub Desktop.
Angular 1.3.0-beta.19 SVG custom element
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
/** | |
creates a circle in the upper left corner of its container | |
with the given radius. `<custom-circle radius="10"/>` | |
*/ | |
app.directive('customCircle', function(){ | |
return { | |
// the following two configuration options are | |
// required for SVG custom elements. | |
templateNamespace: 'svg', | |
replace: true, | |
// NOTE: ng-attr- style binding is used to prevent SVG validation | |
// error messages. | |
template: '<circle ng-attr-cx="{{radius}}" ng-attr-cy="{{radius}}" ng-attr-r="{{radius}}"/>', | |
// everything else as normal | |
scope: { | |
radius: '@', | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment