Questions tagged [ng-switch]

The ngSwitch directive is used to conditionally swap DOM structure on your template based on a scope expression. Elements within ngSwitch but without ngSwitchWhen or ngSwitchDefault directives will be preserved at the location as specified in the template.

Usage

<ANY ng-switch="expression">
  <ANY ng-switch-when="matchValue1">...</ANY>
  <ANY ng-switch-when="matchValue2">...</ANY>
  <ANY ng-switch-default>...</ANY>
</ANY>
197 questions
0
votes
2 answers

Ng-switch doesn't work inside ng-repeat

When i.typ is changed the ng-switch doesn't update in the below code. Maybe this has to do with the ng-repeat oustide the switch? On page reload it works but not when model is changed.
daniel
  • 34,281
  • 39
  • 104
  • 158
0
votes
1 answer

Directive link function called multiple time in ngRepeat

i have a strange behavior in my code with custom directive. The link function is called multiple times but as example if want to initialize a third-part library (example maps) this behavior breaks the lib. link: function(scope) { …
RevH
  • 58
  • 2
  • 8
0
votes
2 answers

Using ng-switch to swap templates

I'm trying to switch a "sign in" form for a "sign up" form whenever the user clicks on the "Sign Up" button in my angular app, but at the moment nothing is happening when the button is clicked; The sign in form remains on the screen and there are no…
bookthief
  • 2,443
  • 8
  • 41
  • 54
0
votes
3 answers

$apply in setTimeout

I konw that $apply used to connect the Javascript context and the AngularJS context. A simple example is below: template:
{{someVal}}
javascript in controller: setTimeout(function() { scope.$apply(function(){scope.someVal = 123}); },…
Stefan
  • 83
  • 1
  • 8
0
votes
1 answer

AngularJs. Render table with ng repeat and ng switch

I'm trying render table with two columns using angularjs directives.
0
votes
2 answers

angularjs: gettext not working in ngSwitch

I'm trying to use gettext in combination with ngSwithc, as follows: ... ...
Jeanluca Scaljeri
  • 26,343
  • 56
  • 205
  • 333
0
votes
1 answer

Clearing an interval when an element housing an angular directive is removed

I've built a simple directive that adds a javascript-based loading animation. It is operating with a window.setInterval() loop. This works great, but when loading is complete, I use ngSwitch to swap in my content, which removes the element housing…
cmw
  • 855
  • 7
  • 17
0
votes
1 answer

Making a switch statement on my partials angularjs

I'm having a problem, i'm unable to get my ng-switch to work on my partials. What I'm trying to do is upload an image but before I upload it I must first check if the included image size doesn't reach 25kb. Here is my controller…
Wondering Coder
  • 1,652
  • 9
  • 31
  • 51
0
votes
0 answers

angular ng-switch not switching between options but appending them

I have the following in my controller which is the variable that the ng-switch depends on: $scope.currentClock = {state: true}; This is what I use to change the value of currentClock.state:
criver.to
  • 520
  • 2
  • 9
  • 18
0
votes
1 answer

Problems when using ng-options and ng-switch together

I have an issue when I am trying to use ng-options and ng-switch together in AngularJS to dynamically change what content is put on the page for a widget builder I am working on. I have two issues I am experiencing: 1. I can't seem to set ng-option…
MrCrowly
  • 168
  • 2
  • 13
0
votes
1 answer

ng-switch element in layout issue

I am using ng-switch to create a filtering input field in the layout. I am switching on the route name and I use this field to filter the data in ng-repeat on each page. div(ng-controller="NavbarCtrl", ng-switch on="route.current.name") …
glasspill
  • 1,290
  • 4
  • 21
  • 36
0
votes
1 answer

ng-switch always true

I want to hide uls if they are empty: