javascript - SVG Inject file to DOM from scope variable -
i'm working on app svg map. installed module svginjector https://github.com/iconic/svginjector. works static url like:
<img class="inject-me" src="data/maps/building1.svg">
i change map based on variable url ($stateparams). controller looks this:
function mapsinglectrl( $scope, $stateparams, userservice, $ionicpopup, $state, $log ) { var vm = this; var mapsingle = {"id": $stateparams.id, "building": $stateparams.building, "floor": $stateparams.floor, "roomid": $stateparams.roomid, "room": $stateparams.room}; $scope.svgmap = "data/maps/building1.svg"; $scope.mapsingle = mapsingle; // inject svg var mysvgstoinject = document.queryselectorall('img.inject-me'); //console.log(mysvgstoinject); svginjector(mysvgstoinject); }
and when use:
<img class="inject-me" src="{{svgmap}}">
file load can see it, not interact - css hover doesn't work anymore.
what can fix issue? in advance advice! ;)
Comments
Post a Comment