How to render svg inside ion-content

2019-04-08 20:23发布

My application is built using Angularjs and ionic, using cordova for hybrid mobile application, when trying to render svg content received from backend, application is unable to render expected diagram.

This is how my code looks like

<ion-tab title="Diagram" icon-on="mcfly">           
        <ion-view>
            <ion-content class="padding" ng-class="{'has-loading': header.isLoading}">
                <h4>System Diagram</h4>                 
                    {{diagram}}
        </ion-content>
    </ion-view>
</ion-tab>

But what I see is svg data instead of image, am I missing any declaration or any thing ?

Thanks

1条回答
兄弟一词,经得起流年.
2楼-- · 2019-04-08 21:12

You need to put it in image tag, like this:

<img class="title-image" src="path to your diagram" width="xxx" height="xxx" />

please check this plunker displaying svg

查看更多
登录 后发表回答