风格如
<div [style.background-image]="\'url(\' + image + \')\'">Background</div>
<div [style.transform]="rotate(7deg)"
Run Code Online (Sandbox Code Playgroud)
不再添加
我有这个printValue变量,在我的角度组件中有一个HTML按钮代码,如下所示:
export class HomeComponent implements OnInit {
printValue = '<button type="button" data-toggle="popover" title="Popover Header" data-content="Some content inside the popover">Popover</button>';
constructor(){}
OnInit(){}
}
Run Code Online (Sandbox Code Playgroud)
问题是,一旦printValue变量放在innerHTML中,我如何使popover工作,如下所示:
<p [innerHTML]="printValue"></p>
Run Code Online (Sandbox Code Playgroud)
这样做
<body>
<button type="button" data-toggle="popover" title="Popover Header" data-content="Some content inside the popover">Popover</button>
</body>
Run Code Online (Sandbox Code Playgroud)
在html文件中直接启用popovers工作.但是如何使它在innerHTML属性中工作?
我正在使用IONIC并从服务器中检索URL,使用<p>标签时可以看到URL ,如下所示:
<p>{{URL}}</p>
Run Code Online (Sandbox Code Playgroud)
但是当我尝试以下操作时:
<video width="320" height="240" controls>
<source src="{{URL}}" type="video/mp4">
</video>
Run Code Online (Sandbox Code Playgroud)
我收到一个错误(Get请求错误),提示“不安全的网址”
我发现有人建议sanitizer.bypassSecurityTrustResourceUrl像在此页面中那样使用,但不幸的是,它对我不起作用
注意:视频位于项目文件夹中,并且URL是从数据库中检索的。
如何启用<video>标签以播放项目目录中的视频?