Any idea how to use ng-repeat and ng-switch together?
-
I have an issue when I am trying to use ng-options and ng-switch together in AngularJS. Any idea how to use ng-repeat and ng-switch together?
-
Answer:
Declare an on directive on your ng-repeat like so: <div ng-repeat="..." ng-switch on="item.itemType" > Then inside your repeater you can evaluate the expression inside the on directive like so: <my-type ng-switch-when='1' > ng-switch-when will be evaluated against the on directive in the repeater. If the statement evaluates to true, it will be rendered. In this example item.itemType would need to have a value of 1 to be rendered out. For ng-options however using an ng-switch doesn't make any sense as you can't include any custom html inside a select. If you need a filter or a group by you can do that in the ng-options expression directly. See the docs here: https://docs.angularjs.org/api/ng/directive/ngOptions
yido at Stack Overflow Visit the source
Related Q & A:
- How To Use Omegle With Proxy?Best solution by iamsport.org
- How to open a new ng-view inside ng-view?Best solution by Stack Overflow
- How do I fix my PSP WLAN switch?Best solution by ehow.com
- Do women have any idea how hard it is for men to ask them out?Best solution by psychologytoday.com
- How do you mix a bunch of songs together?Best solution by on.aol.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.