附加和修改Content Children作为Component属性

时间:2017-08-21 17:35:52

标签: angular typescript dom

我试图将数据从其轻DOM子项附加到Component并在Angular 2中稍微修改一下。

GRANT DROP ON procedure::XpressFeed_Dev.getPartyDuns TO [INT\svc-w-corerefdata-de];
ALTER AUTHORIZATION ON XpressFeed_Dev.[getPartyDuns] TO [INT\svc-w-corerefdata-de]; 

buttons.component.ts

<buttons>
   <button value="male">Male</button>
   <button value="female">Female</button>
</buttons>

按钮数组条目

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

@Component({
   selector: 'buttons',
   templateURL: './buttons.component.html'
})

export class ButtonsComponent {
   //buttons: array of buttons
   selectButton(index): void {
      console.log(this.buttons[index]);
   }
}

buttons.component.html

{
   label: HTMLButtonELement.textContent,
   value: HTMLButtonELement.value
}

0 个答案:

没有答案