Angular2: replace host element with component's template

前端 未结 5 1708
别跟我提以往
别跟我提以往 2021-01-30 17:23

I\'m new to angular in general and to angular2 specifically. I\'m trying to write a container component, which should have child components in it.

5条回答
  •  -上瘾入骨i
    2021-01-30 18:08

    In the latest angular you can even avoid adding

    I've applied is like:

    import {Component} from '@angular/core';
    
    @Component({
        selector: 'div[app-root]',
        templateUrl: 'app.component.html',
        styleUrls: ['app.component.css']
    })
    export class AppComponent {
        title = 'Delegates Presence Reporting';
    }
    

    and the template:

    {{title}}

    index.html

    
    

提交回复
热议问题