我想使垫卡可点击,当我将鼠标悬停在垫卡上时,我想显示链接光标。当我单击其中一张要导航到另一页的卡片时,有很多卡片。我该如何实现?
在我的模板html中使用以下代码是否合适。
inputs = np.linspace(0,10,100).reshape(-1,1)
for i, deg in enumerate([1, 3, 6, 9]):
poly = PolynomialFeatures(degree=deg)
X_poly = poly.fit_transform(X_train.reshape(-1,1))
linreg = LinearRegression().fit(X_poly, y_train)
print(linreg.predict(inputs))
我的第一次尝试是
ValueError Traceback (most recent call last)
<ipython-input-5-4100ae3f3ba3> in <module>()
13 return
14
---> 15 answer_one()
<ipython-input-5-4100ae3f3ba3> in answer_one()
9 X_poly = PolynomialFeatures(degree=deg).fit_transform(X_train.reshape(-1,1))
10 linreg = LinearRegression().fit(X_poly, y_train)
---> 11 print(linreg.predict(inputs))
12 # print(linreg.score(X_poly, y_train))
13 return
/opt/conda/lib/python3.6/site-packages/sklearn/linear_model/base.py in predict(self, X)
266 Returns predicted values.
267 """
--> 268 return self._decision_function(X)
269
270 _preprocess_data = staticmethod(_preprocess_data)
/opt/conda/lib/python3.6/site-packages/sklearn/linear_model/base.py in _decision_function(self, X)
251 X = check_array(X, accept_sparse=['csr', 'csc', 'coo'])
252 return safe_sparse_dot(X, self.coef_.T,
--> 253 dense_output=True) + self.intercept_
254
255 def predict(self, X):
/opt/conda/lib/python3.6/site-packages/sklearn/utils/extmath.py in safe_sparse_dot(a, b, dense_output)
187 return ret
188 else:
--> 189 return fast_dot(a, b)
190
191
ValueError: shapes (100,1) and (2,) not aligned: 1 (dim 1) != 2 (dim 0)
答案 0 :(得分:2)
<a *ngFor="let card of childCards" [routerLink]="[card?.targetUrl]">
在锚标签内写入垫卡代码。
答案 1 :(得分:0)
为什么不将Mat-card包裹在<a>
中,但请确保删除其上的下划线样式
相关的 HTML :
<a class='removeStyle' href='#'>
<mat-card class="example-card">
....
</mat-card>
</a>
相关的 CSS :
.removeStyle{
text-decoration: none;
}
答案 2 :(得分:0)
HTML
<mat-card (click)="redirect(100)">
<mat-card-content>
<div> $100 </div>
<div> 3000 ETB</div>
</mat-card-content>
</mat-card>
<mat-card (click)="redirect(200)">
<mat-card-content>
<div> $200 </div>
<div> 4000 ETB</div>
</mat-card-content>
</mat-card>
CSS
mat-card {
cursor: pointer;
margin-bottom: 1rem;
}
TS
redirect(id) {
alert('Called from ' + id);
}