hexuanzhang / AngularJS2

AngularJS2笔记
0 stars 0 forks source link

Component 之 selector #7

Open hexuanzhang opened 7 years ago

hexuanzhang commented 7 years ago

selector

支持 element, [attribute], .class:not() 四种选择器。

@Component({
    selector: 'selector-element',
    template: `元素选择器`
})
@Component({
    selector: '[selector-attr=attr]',
    // selector: '[selector-attr]'
    template: `属性选择器`
})
@Component({
    selector: '.selector-class',
    template: `类选择器`
})
@Component({
    selector: 'span.selector:not(.selector-not)',
    template: `not 选择器`
})

参考资料