Questions tagged [angularjs-ng-switch]

The ngSwitch directive is used to conditionally swap DOM structure on your template based on a scope expression

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.

Doc Link

28 questions
8
votes
5 answers

Angular2 ngSwitch not working

I have an ngSwitch for a model attribute bound to a drop-down. It wasn't working, so I tried to simply hard-code the value. Still doesn't work, it displays both divs. What am I doing wrong? Apologies in advance if it's something obvious, I'm new…
Arlo Guthrie
  • 1,152
  • 3
  • 12
  • 28
5
votes
1 answer

How to ngSwitchCase in ngFor?

From example in my code. tabs: object = [ { key: 'tab1', value: 'tab1' }, { key: 'tab2', value: 'tab2' }, { key: 'tab3', value: 'tab3' }, ];
{{…
ThunderBirdsX3
  • 558
  • 1
  • 9
  • 25
5
votes
1 answer

ng-switch-when-separator not working in angularJS

ng-switch is not working when i use ng-switch-when-separator . when I select settings the switch is pointing to default div angular.module("myModule", []) .controller("myController", function ($scope) { $scope.items = ['settings', 'home',…
RJV
  • 287
  • 1
  • 7
  • 20
5
votes
4 answers

angularjs: Change parent scope from controller within a ng-switch

So, I can change a model value from a child controller, but when the child controller is in ng-switch then it doesn't work, why? I created an example to demonstrate it. One way to avoid this is to use the . in the model name, like bunnies.kills. Is…
2
votes
1 answer

Can I use ng-switch with ng-repeat?

I have an array called $scope.sectionList: 0: {id: "1", section_name: "About me (in detail)"} 1: {id: "2", section_name: "About me (single word)"} 2: {id: "3", section_name: "My freaky side (in detail)"} 3: {id: "4", section_name: "My freaky side…
2
votes
3 answers

How can I disable an ng-click after a click inside a ng-if ng-switch statement?

I have a flag button that when a user clicks on, flags the discussion, and afterwards the flag button is replaced with text 'successfully flagged'. Currently I am having trouble from disabling ng-click after clicking the flag button. ng-click still…
2
votes
2 answers

ng-switch-when and ng-class compatibility

I was wondering if there were no compatibility issues when ng-switch-when and ng-class are using on the same element like in this sample. I'm trying to dynamically change the class of this four elements but for some reasons this isn't working on all…
Brain Up
  • 163
  • 2
  • 10
1
vote
2 answers

How to use ngSwitch with *ngFor in Angular 6

I have a Map as follows with dynamic keys and values public featureData = new Map(); Key value pairs will be as follows (other dynamic values may present) [ {"name" : "Bangalore"}, {"type" : "city"}, {"lat" : "12.9716"}, …
Basil
  • 1,664
  • 13
  • 25
1
vote
2 answers

Angular js: Ng-switch is not updating after ng-click

In my original code, I first check if a user can flag a discussion, if they can I have the ng-switch where if they flag it they will see success message appear:
1
vote
3 answers

Howto use ng-switch inside ng-repeat for editing JSON API data

I know this is a recurring question but unfortunately I couldn't find a proper answer to my case. Basically I'm getting data from an JSON API endpoint which gets displayed in a table using ng-repeat. I now want to ng-switch the view to input fields…
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

How to add many fields with ng-switch (angularjs)

I have two nested ng-repeat,and i wanted to add the same form MiseEnContext many times,inside this "MiseEncontext" i wanted to add some inputs, but when i add text it's added for all my MiseEnContext Question: How to isolate my MiseEncontext…
0
votes
1 answer

Apply ng-switch only on tags

I have the following code that works: {{ x.a }} {{ x.a }} I'd like…
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
0
votes
2 answers

AngularJS Form - How to create and update several emails with ng-switch

I have a form in order to add / update one or several emails. The first email field is mandatory. After filling the field it's possible to click on "Add email" for adding a new email address. By this way it's possible to add 4 others emails (5…
0
votes
1 answer

how does content load with ng-switch

Our team is developing an app in ServiceNow and has created a big widget that embeds a couple other widgets. Each embedded widget is contained in its own tab and we're using ng-switch to toggle between each one. ServiceNow has a client API called…
Dave
  • 1,257
  • 2
  • 27
  • 58
1
2