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
1
vote
1 answer

Create a wizard in angularjs. Which is the best approach?

I must create a wizard using angularjs ... I don't know angularjs very well and I know this is a problem... so my doubts are if I am using the correct approch to create the wizard... Here the main questions I cannot find a answer: Should I use…
Simone
  • 2,304
  • 6
  • 30
  • 79
1
vote
2 answers

Dynamic ng-switch inside of ng-repeat

I am trying to create a switch based on a dynamic array of objects... For example:

{{item.name}}

developthewebz
  • 1,827
  • 3
  • 17
  • 43
1
vote
1 answer

How to simplify ng-switch with similar elements?

I have the following code:
Christopher
  • 3,379
  • 7
  • 25
  • 36
1
vote
2 answers

how to use ng-switch-when for not empty json?

I an new in angularjs and I have json in my angularjs application, I want ng-switch to work when that json is not empty(it is an array). it's a large json and I'm talking about one part of it,is it possible with ng-switch? or I should set scope…
Shirin Abdolahi
  • 1,047
  • 8
  • 18
1
vote
1 answer

Scope changes after ng-switch

I have a switch that changes the value of a variable called p.
/*...show nodes and ability to add node*/
/*for now show nothing*/ …
Anna
  • 101
  • 8
1
vote
1 answer

ng-switch is not working as expected

Maybe the use of the 2-ways binding and $watch is still not very clear to me.. but I was expecting that this piece of code should work! I have a topNavbar directive in my index.html page. The topNavbar should show the loginButton if the user is not…
DeLac
  • 1,068
  • 13
  • 43
1
vote
1 answer

Change view after a post in AngualJs

I am doing a SPA. I am using ngResources and I have a really simple form. User can compile it and after he submit the form should appear a new form with only a message that says something like this: "Thank you to use our form ..." I would like to…
Simone
  • 2,304
  • 6
  • 30
  • 79
1
vote
1 answer

ng-switch inside ng-repeat Angularjs

i have question how to use ng-switch inside ng-repeat and use scope for switch-on ? example :
1
vote
1 answer

Angular JS: ng-switch not working

I am trying to use ng-switch in my application. In Routing configuration : when('/Test/:TestName/formEditor/:openedFrom', { templateUrl: 'Testing.html', controller: 'TestCtrl' }) In my HTML
1
vote
1 answer

When has ng-switch finished rendering?

I'm using ui-router and trying to instantiate a widget that takes as a parameter a DOM element specified by id. This DOM element is in a
and I want to call the widget constructor when the element is guaranteed to exist.
Dan Dascalescu
  • 143,271
  • 52
  • 317
  • 404
1
vote
1 answer

AngularJS: jQuery Steps error

I have some 3 steps done in jQuery Steps plugin. The steps need to be changed dynamically when the URL path changes(which happens due to a navigation on same page). The dynamic change of content is brought by ng-switch. The problem is: The first…
batmaniac7
  • 422
  • 5
  • 17
1
vote
1 answer

AngularJS - Apply class to based on ng-switch statement

I have a simple ng-repeat on a . Wihtin the ng-repeat is a ng-switch directive. I want to know how to apply a CSS class to a when a a particular ng-switch condition is met.
Oam Psy
  • 8,555
  • 32
  • 93
  • 157
1
vote
3 answers

AngularJS Trying to use ng-click with ng-switch but ng-switch is not switching my divs

AngNoob here. I have some global navigation that uses the routeProvider to swap out external html pages inside the view. Within the view i set up a list type sub navigation (created with ng-repeat) that switches out divs in the external html file. I…
1
vote
1 answer

AngularJS manually render controller and template containing ng-switch directive

Following the advise of this answer, I've been trying to render a controller and template manually, but I can't get it to work when the template contains an ng-switch directive. Any ideas? Here's the fiddle: http://jsfiddle.net/kynZm/
Stephen Bunch
  • 327
  • 4
  • 15
1
vote
2 answers

Angular only putting attribute of ng-minlength if parsed value is not nil

I want to only set my attribute of ng-minlength when the value I parse from data.Validation['minlength'] is not nil. First I attempted using ng-switch; I had no problem doing this when handling ng-show=true/false. However I was unable to get it…
Nicklas Kevin Frank
  • 6,079
  • 4
  • 38
  • 63