SVG and ng-bind-html is not working on IOS using Ionic Framework

谁都会走 提交于 2020-01-15 09:02:56

问题


I am struggling to get my little ionic app to show an SVG file in IOS using the IonicFramework.

It works in the browser and also on Android 5.0 but when I try it out in IOS my flag does not appear.

If i add the flag hardcoded into the html the flag appears as it should...

Hmm what am i doing wrong?? The example is based on a new Ionic project using the blank template...

JS snippet:

.controller('myCtrl', function($scope) {

  var flag='<polygon points="0 0,0 60,120 40,120 20" fill="white" /><polygon points="0 0,24 4,24 56,0 60" fill="red" /><polygon points="48 8,72 12,72 48,48 52" fill="red" /><polygon points="96 16,120 20,120 40,96 44" fill="red" /><polygon points="0 0,0 60,120 40,120 20" fill="none" stroke="black" stroke-width="0.1" />';

  $scope.myflag = flag;
});

HTML snippet:

<p>Postponed! (does not work)</p>
<svg ng-bind-html="myflag"></svg>

http://codepen.io/flemmingdjensen/pen/XbRKLV

来源:https://stackoverflow.com/questions/30682004/svg-and-ng-bind-html-is-not-working-on-ios-using-ionic-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!