3
我希望有人能为我解决这个问题。我假设对此有一个简单的答案。但如果它出现在互联网上,我似乎无法找到它。请记住,我有一点经验,所以我很抱歉,如果我失去了一些明显的东西。Angular 2 @View with template vs @Component with template
我看到下面的实施例在那里为在角2.
//Example 1
@Component({
selector: 'my-app'
})
@View({
template : '<p></p>'
})
据我所知创建模板,上面的例子是相同的,因为这。
// Example 2
@Component({
selector: 'my-app',
template: '<p></p>'
})
根据这一https://angular.io/docs/ts/latest/api/core/View-decorator.html这@Directive v/s @Component in angular2
那么有没有什么好的理由来创建一个像第一个例子VS第二哪里@View
似乎通过@Component
被隐式设置使用模板“模板”?
谢谢。我不知道那个..我会看看。 –