0
イオンラベル要素に文字列を追加する指令があります。イオンラベルのテキストの変更方法
/**
* icon used everywhere to indicate this is a required form field
* usage: <ion-label required> blah </ion-label>
* outputs: <ion-label required> blah <span>*</span> </ion-label>
*/
@Directive({
selector: 'ion-label[required]',
})
export class ReqIconComponent {
constructor(el: ElementRef) {
debugger;
el.nativeElement.innerHTML = el.nativeElement.innerHTML.concat('<span> * </span>');
}
}
イオンラベル要素内の "blah"テキスト値にアクセスするにはどうすればよいですか?
innerHTMLとinnerTextは両方とも ""です。 子ノードと子は両方とも長さが0です。
上記の結果をされては、<イオンラベル...> *何とか – Stevko
ngAfterViewInitに – Duannx
おかげで、あなたのコードを移動してください。答えを作成し、私はそれを受け入れるでしょう。 – Stevko