出于某种原因,无论我使用哪种格式来构造ngSwitch,唯一有效的指令就是* ngSwitchDefault。
这是我的代码:
tf = TfidfVectorizer(tokenizer=normalize, decode_error = 'ignore',max_features=10000)
tfidf_matrix = tf.fit_transform(aux['enlarged_description'])
#cosine_similarities = linear_kernel(tfidf_matrix, tfidf_matrix)
X = pairwise_distances(tfidf_matrix, metric = metrics,n_jobs = -2 )
答案 0 :(得分:0)
问题在于,在评估字符串时,必须将其放在单引号中,因此修复非常简单:
<div class="icon-group" [ngSwitch]="published?.availableOn">
<mat-icon *ngSwitchCase=" 'Android' " fontSet="fontawesome" fontIcon="fa-android" class="green-icon"></mat-icon>
<mat-icon *ngSwitchCase=" 'Windows' " fontSet="fontawesome" fontIcon="fa-windows" class="blue-icon"></mat-icon>
<mat-icon *ngSwitchCase=" 'iOS' " fontSet="fontawesome" fontIcon="fa-apple"></mat-icon>
<mat-icon *ngSwitchCase=" 'Web' " fontSet="fontawesome" fontIcon="fa-internet-explorer"></mat-icon>
<ng-container *ngSwitchCase=" 'AndroidiOS' ">
<mat-icon fontSet="fontawesome" fontIcon="fa-android" class="green-icon"></mat-icon>
<mat-icon fontSet="fontawesome" fontIcon="fa-apple"></mat-icon>
</ng-container>
<mat-icon *ngSwitchDefault fontSet="fontawesome" fontIcon="fa-internet-explorer"></mat-icon>
</div>