When I use my custom pipe in a template, it is like this:
{{user|userName}}
And it works well.
Is it possible to use a pipe in the code?
I try to use it like this:
let name = `${user|userName}`;
But it shows
userName is not defined
My alternative way is using db.collection.findOne()
manually in the code. But is there any smart way?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…