简体   繁体   English

如何为微调器创建 angular 指令?

[英]How to create angular directive for spinner?

I work on project and used ngx-spinner library and now want to make directive for this spinner and write the HTML code inside directive我在项目上工作并使用了 ngx-spinner 库,现在想为这个微调器制定指令并在指令中编写 HTML 代码

<ngx-spinner type="ball-scale-multiple" [fullScreen]="false" size="" style="width: 100px;" bdColor="rgba(0, 0, 0, 0.5)">loading ...</ngx-spinner>

how can i do that我怎样才能做到这一点

The solution i found is to create separate component for the spinner我找到的解决方案是为微调器创建单独的组件

<ngx-spinner type="ball-scale-multiple" [fullScreen]="false" size="larg" style="width: 100px;"
bdColor="rgba(0, 0, 0, 0.2)">
<p style="color: white;"> loading ...</p>
and the directive 和指令
<div *appSpinner="showSpinner">content</div>

and use the directive on elements in this way并以这种方式在元素上使用指令

<div *appSpinner="showSpinner">content</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM