我有一个指令,应该将一个字符串附加到离子标签元素。
# coding: utf-8
from dask import delayed
@delayed
def load(filename):
print("Load " +filename)
return filename
@delayed
def clean(data):
if data == 'c.data':
return None # <========== Aborting
print("clean " + data)
return data
@delayed
def analyze(sequence):
for s in sequence:
if not s:
continue
print("Analyzing " + s)
inputs = ['a.data','b.data', 'c.data']
loads = [load(i) for i in inputs]
cleaned = [clean(x) for x in loads]
analysis = analyze(cleaned)
analysis.visualize()
analysis.compute()
如何访问&#34; blah&#34;离子标签元素中的文本值?
innerHTML和innerText都是&#34;&#34;。 childNodes和children都是长度为0。
答案 0 :(得分:1)
因为在构造函数中,视图未呈现,因此无法获取innerHTML
。将代码移至ngAfterViewInit
以等待视图完全呈现。
ngAfterViewInit(){
this.el.nativeElement.innerHTML = this.el.nativeElement.innerHTML.concat('<span> * </span>');
}