组件上的角度绝对新手问题

时间:2018-10-05 16:18:47

标签: angular

tl; dr:非常简单的组件仅显示一次。为什么?

我有这个组件:

function updatetaille(){
    var i,taillecaract='';
    var taille=$('#taille'+i).val();
    var quantite=$('#quantite'+i).val();
    for(var i=1;i<=12;i++){
        if (taille!='') {
          taillecaract+=taille+':'+quantite+',';
        }
      }
      $('#tailles').val(taillecaract);
    }

然后在下一页(Index.html)中使用它:

import { Component } from "@angular/core";

@Component({
    selector: 'testComponent',  
    template: '<div><h1>{{pageTitle}}</h1></div>'
})

export class AppComponent {
    pageTitle: string = "Title";
 }

页面显示“标题”(很明显)。但是,如果我将html更改为:

<html>
  <body>
      <testComponent></testComponent>
  </body>
</html>

它仍然仅显示一次“标题”。它不应该显示两次吗?

0 个答案:

没有答案