指令使用类选择器

时间:2018-04-26 10:01:39

标签: angular

我有以下指令选择类 <ngx-datatable class="data-table table-responsive task-list-table" [rows]="branches" [loadingIndicator]="loadingIndicator" [columnMode]="'force'" [headerHeight]="50" [footerHeight]="50" [limit]="10" [rowHeight]="66" [reorderable]="reorderable"> <ngx-datatable-column name="Branch Office Name"> <ng-template let-rowIndex="rowIndex" *ngIf="rowIndex != 0" let- branch="row" ngx-datatable-cell-template> {{branch['name']}} </ng-template> </ngx-datatable-column> <ngx-datatable-column name="Parent Branch"> <ng-template let-rowIndex="rowIndex" *ngIf="rowIndex != 0" let- branch="row" ngx-datatable-cell-template> {{branch['parentOrganizationName']}} </ng-template> </ngx-datatable-column> </ngx-datatable>

的元素
.class

以下模板:

import {Component, Directive} from '@angular/core'

@Directive({
  selector: '.box',
  host: {
    '(click)': 'onClick($event.target)'
  }
})
export class Box {
  onClick(btn) {
    console.log("clicked");
  }
}

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent {}

点击div时,我错过了什么让它成功?

1 个答案:

答案 0 :(得分:0)

Box指令应该在模块声明中导入

    Use recipes;
    Go

    Select
        RecipeName
    From
        recipe
    Where
        RecipeName Not In
        (
            select
                RecipeName
            from
                recipe
            where
                IngredientName IN ('EGG','EGGS')
            Group By
                RecipeName
        );
    Go