14 lines
542 B
Markdown
14 lines
542 B
Markdown
|
---
|
|||
|
title: Creating a New Directive in Angular
|
|||
|
localeTitle: 在Angular中创建一个新的指令
|
|||
|
---
|
|||
|
你还记得从角度过程中形成的自定义指令吗?您也可以制作自定义指令!
|
|||
|
```
|
|||
|
>> yo angular-fullstack:directive newdirective
|
|||
|
```
|
|||
|
|
|||
|
如果你需要一个自定义指令的html模板(也许你只是制定一个指令来清理你的HTML代码),告诉它在提示你时创建一个html文件,你就可以包含这些内容在您的应用中的任何位置使用该模板:
|
|||
|
```
|
|||
|
<newdirective></newdirective>
|
|||
|
|
|||
|
```
|