在阅读与Angular2相关的在线博客时,我遇到以下语法。Angular 2模板语法
@Component({
selector: 'app',
template: require('./app.component.html'),
styles: [require('./app.component.css')],
directives: [ ROUTER_DIRECTIVES ],
})
以下两种说法有何不同?这里需求函数的作用是什么?
- 模板:要求( './ app.component.html ')
- 模板:' ./app.component.html'
在上述声明中的负载是否需要HTML模板异步?
这是否意味着模板:要求(” ./ app.component。html')语句将拉取模板文件;以字符串的形式读取其内容并在运行时将其分配给模板?还是在编译时本身发生? –
我不知道运行时/ compileTime,但是这个语句将拉模板作为字符串,并显示为视图。 –