समस्या: मैं test
फ़ंक्शन को चलाने के लिए चाहता हूं जब मैं एक एसवीजी ग्राफ़िक में <path>
तत्व पर क्लिक करता हूं। जब मैं तत्व पर क्लिक करता हूं तो अभी कुछ भी नहीं होता है। हालांकि - जब मैं onclick="alert('success')"
के साथ प्रतिस्थापित करता हूं तो अलर्ट ठीक काम करता है। कोई सुझाव?एंगुलरजेएस और एसवीजी - <rect> तत्व पर एनजी-क्लिक का उपयोग कर?
मेरी कोड में ... मेरी html के
खंड ...
<div ng-controller="converter">
<embed src="/image.svg">
<!--This button successfully runs the test function-->
<button ng-click="test()">Test</button>
</div>
मेरी app.js ... मेरी एम्बेडेड एसवीजी फ़ाइल का
var app = angular.module('app', []);
app.controller('converter', ['$scope', '$http', function($scope, $http){
$scope.test = function(){
console.log("this click event is working");
}
}]);
भाग ..
<rect id="e1-1-2" data-name="e1-1" class="cls-35" x="14" y="106" width="57" height="22" ng-click="test()"/>
(यहां पूरा कोड है, एफ या उन रुचि: https://github.com/cwklausing/angular_guitar)
आप 'rect' तत्व और' button' तत्व –
@ARIFMAHMUDRANA में 'एनजी-click' जोड़ा , और क्या गलत है? – Grundy
_embed_ – Grundy