javascript - svg and angularjs - a simple ngClick example -
i have simple problem (i hope). bind svg element , angularjs. here how problem looks like:
<svg> <g ...> <text ... ng-click="count=count+1" ng-init="count=0">click me!</text></g></svg>
outside <svg>
have following code:
count: {{count}}
i clik on "click me!" , see how many clicks did make. not work. see no result, question why? nothing more example angularjs webpage: ngclick example angularjs.
when use example without/outside <svg>
(let button - in official angularjs webpage):
<button ng-click="count = count + 1" ng-init="count=0"> click me! </button>
the angularjs work. there restrictions regarding <svg>
, angularjs? or perhaps have use trick use it?
great in advance tip or help!
nykon
angular directives work fine inside of svg. see below code, using ng-click function:
count: {{count}} <svg width="100" height="100"> <circle ng-click="count=count+1" ng-init="count=0" cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" /> </svg>
svg angular ng-click example in plunker: http://plnkr.co/edit/kvhka68oz6yxqijzyixg?p=preview
Comments
Post a Comment