发新话题
打印

angular 如何解析页面?

angular 如何解析页面?

angular 如何解析页面?
1. 首页,index.html
2. 找到 ng 自定义标签 app-root
3. 在 app.moudle.ts 里找到 @component.selector 为  app-root的组件 AppComponent
4. 在 app.component.ts 里,找到 templateUrl,styleUrl
5. 模板里,有ng 变量  {{title}}, 在 AppComponent里,找到 title的值,替换

一般地,页面无非是由,html,css,js来组成,为了便于与普通的html相区别, ng目录下的 index.html,实际上可以看作是带ng组件标签的模板文件,姑且称之为  index.ngml
1. 假设在浏览器端收到的html文件,是 index.html, 那么这个html的内容:生成的html
a) index.ngml的标准标签部分
b) ng组件标签部分
c) {{}}替换后的动态内容

2.  index.html引入的相应css,假设是 index.css , 是由 index.ngml 自引入的

TOP

发新话题