是否有angularjs视图的命名约定?

时间:2016-06-25 11:15:09

标签: angularjs naming-conventions

例如,我有not found个html页面。我应该命名吗

1. not-found.html
2. notFound.html

文件名惯例是什么?

2 个答案:

答案 0 :(得分:1)

如果您遵循john papa角度样式,那就是not-found.html。但说真的,只要选择对你来说最自然的那个:)

答案 1 :(得分:1)

虽然我不了解广泛采用的惯例,但我个人使用camelCase,notFound.html。我喜欢在Angular文件中执行此操作,因此notFound.directive.html用于与notFound.directive.js指令关联的模板。

Angular需要注意的一个要求是,需要将camelCased指令名称转换为&#34; dashed&#34;在HTML中引用时。因此,要在HTML中引用notFound指令,您需要引用<not-found></not-found>

一般来说,有关Angular惯例帮助我的资源是John Papa的风格指南,here。请注意,他实际上建议not-found.html,但这个特定情况再次取决于个人偏好。

相关问题