2016-12-05 145 views
0

我使用AngularJS 1.5.8,我需要我的用戶過濾器:無論是與文本輸入字段(searchEmployeesText)下拉框(vm.selectedUser): 只有下拉框它看起來像這樣和正常工作:AngularJS過濾器或組合

| filter: {user: {surname: vm.selectedUser.surname}} 

其實我不知道要使用這兩種方法:

| filter: {user: {surname: vm.selectedUser.surname or searchEmployeesText}}   (this does not work but only to show what I would neet) 

回答

0

使用||嘗試,而不是你的條件之間or

| filter: {user: {surname: vm.selectedUser.surname}} || {user: {surname: earchEmployeesText}}" 

另請檢查this answer以結合更多條件。