Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Angular2中使用svg_Angular_Svg - Fatal编程技术网

如何在Angular2中使用svg

如何在Angular2中使用svg,angular,svg,Angular,Svg,我有一个svg形式的对象。如何与Angular2配合使用?如何在path中使用ngclass <div *ngIf="isSelect(false); else noSelectUpVote"> <a> <svg viewBox="0 0 29 15" width="29" height="15"> <g> <path class="vote-select" d=

我有一个svg形式的对象。如何与Angular2配合使用?如何在path中使用ngclass

<div *ngIf="isSelect(false); else noSelectUpVote">
    <a>
        <svg viewBox="0 0 29 15" width="29" height="15">
            <g>
                <path class="vote-select" d="M0 15h29l-14.5-15" />
            </g>
        </svg>
    </a>
</div>
<ng-template #noSelectUpVote>
    <a>
        <svg viewBox="0 0 29 15" width="29" height="15">
            <g>
                <path class="vote-no-select" d="M0 15h29l-14.5-15" />
            </g>
        </svg>
    </a>
</ng-template>

像这样试试
ngClass


[ngClass]=“{'style1':isClass1Visible,'style2':isClass2Visible}”

有什么问题?你想完成什么?你卡在哪里了?我不想重复代码。SVG被复制,只有路径中的类发生了更改。仍然不知道问题是关于什么。如果您需要IE10+支持,可以在angular cli中添加Polyfill以支持SVG上的ngClass“”,请选中
polyfills.ts
查看
classlist.js