使用@View注释VS在@Component注解指定参数 [英] Using @View annotation vs specifying parameters in the @Component annotation
问题描述
在Angular.io文档它说,每个角分量需要一个单一的@Component和至少一个@View注释。 链接但是,即使它有这个例子,不使用@View注释。
In the Angular.io docs it says that "Each Angular component requires a single @Component and at least one @View annotation." LINK But even the example that it has, does not use an @View annotation.
我的问题是,是在@Component注释使用@View或指定的参数(templateUrl,StyleUrls等)之间的区别?
My question is, what is the difference between using @View or specifying the parameters (templateUrl, StyleUrls, Etc.) in the @Component annotation?
谢谢你们!
推荐答案
正如你所看到的此处 - @View现在是可选的(该文档是过时的)
As you can see here - @View is now optional (the docs are outdated).
这两个选项是相同的 - 使用@View作为一个单独的注释(以备后用每个组件不同的看法),或者在使用@Component注释中模板等。
Both options are the same - using @View as a separate annotation (for later use of different view per component) or using 'template' etc from within @Component annotation.
希望这能回答你的问题。
Hope that answers your question.
这篇关于使用@View注释VS在@Component注解指定参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!