what is the difference between ngSwitch and ngInclude?
I really need to understand the difference, so I can continue on my project.
Does the ngSwitch hides only the dom elements?
You may find the v1.1.4 documentation more helpful (just ignore the stuff about animations if you are not using 1.1.4): ngSwitch
ngSwitch
conditionally adds/removes DOM elements (ng-show/hide
alters CSS).
ngInclude
can fetch partials/external HTML fragments.
Both create new child scopes that prototypically inherit from their parent scopes. (A new child scope is created for each ng-switch-when/default
.)
You can use ngInclude
with ngSwitch
: https://stackoverflow.com/a/12584774/215945
Use ngInclude
when you want to (or can) reuse HTML fragments, such as client UI (https://stackoverflow.com/a/13005658/215945).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With