Conditional styling on host element

前端 未结 4 2262
既然无缘
既然无缘 2021-02-19 07:04

I have a component that all it does is render , its something like this:

@Component({
     selector: \'my-comp\',
     host: ???,
     template: `
         

        
4条回答
  •  灰色年华
    2021-02-19 07:37

    I think you want to let your component fire an event that can be catched by the host (and possibly pass some data with it).

    To do that you would have an @output property like:

    @Output() isChanged: EventEmitter = new EventEmitter()
    

    then in your code you could do:

    this.isChanged.emit(some value to pass)
    

    And catch it like:

    (isChanged)="doSomething($event)"
    

提交回复
热议问题