我想做点什么
<span *ngIf="admins.includes(name) | async">
其中admins
在组件类中定义为admins:Observable<string[]>
我知道这不起作用,但有可能以任何方式实现这一目标吗?
非常感谢你的帮助!
答案 0 :(得分:3)
async管道需要在observable本身上,如下所示。
import math
import statistics
def fileRead():
"Reads the input file and stores the x and y coordinates in a parallel list"
dataFile = open('datafile1.txt', 'r')
dataList = [] # list comprised of x and y pairs
x = [] # list comprised of just x coordinates
y = [] # list comprised of just y coordinates
for dataLine in dataFile:
dataList.append(dataLine)
dataSplit = dataLine.split()
x.append(float(dataSplit[0]))
y.append(float(dataSplit[1]))
return x, y
def getMean(dataList):
"Computes the mean of the data set"
dataMean = statistics.mean(dataList)
return dataMean