Angular 如何在输入中对所选字符串设置ngIf?
如果在输入中选择了某个值,我想显示元素Angular 如何在输入中对所选字符串设置ngIf?,angular,input,Angular,Input,如果在输入中选择了某个值,我想显示元素 *ngif="currentSort=='category-1'"//in my div it doesnt work currentSort: string = "most-0"; currentCategory: string = "family-0"; options = [{ value: 'most-0', viewValue: 'Najczęściej używane słowa' }, { value: '
*ngif="currentSort=='category-1'"//in my div it doesnt work
currentSort: string = "most-0";
currentCategory: string = "family-0";
options = [{
value: 'most-0',
viewValue: 'Najczęściej używane słowa'
}, {
value: 'category-1',
viewValue: 'Kategorie'
}, ];
我如何做到这一点?您的语法不正确。使用*ngIf而不是*ngIf。
善良的问候我不确定我是否真的理解这个问题,但请确保*ngIf是大写字母,而不是像你所说的小写字母如果currentSort=='category-1'显示我的元素,如果currentSort=='most-0'销毁我的元素,我如何做到这一点?不,现在你的建议就是解决方案。谢谢,没问题。很高兴它起作用了