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

Angular 9 - ngSwitch not linked

I got a form that is supposed to change according to the case I selected in a dropdown: The type of the room is taken : simple, doubles or triples. But, although I read about the ngSwitch to display the DOM (a simple form), I cannot link the 2…
LucasClement
  • 63
  • 1
  • 5
0
votes
1 answer

Slow performance of PrimeNG Turbo Table in IE 11

We're using PrimeNG's Turbo Table with dynamic columns to display 1000 records per page.Both server-side pagination and sorting are enabled. This works well in Chrome but it is staggeringly slow in IE during sorting, pagination or updating all the…
0
votes
2 answers

Return a letter grade based on value

I am trying to return a letter grade based on specified criteria using ngSwitch. What am I doing wrong? Sometimes it returns all 5 letter grades when I refresh the page. A: 100-90 B: 89-80 C: 79-70 D: 69-60 F: < 60 This is my app.component.html…
libracorn
  • 317
  • 4
  • 9
0
votes
2 answers

ion-segment-button: dynamically checked not working

In my angular application I tried to dynamically generate ion-segment-buttons for each day of the week and then check today initially. template:
Paul Costa
  • 13
  • 5
0
votes
1 answer

How to solve the ngSwitchCase in Angular?

I've got a problem with my ngSwitchCase. Well the problem is that the case doesn't correctly fulfill its job. When I drag and drop a textbox, a textbox should appear. But When I drop the textbox, I get a textbox and textarea, which is another…
Liza Darwesh
  • 401
  • 1
  • 3
  • 20
0
votes
0 answers

Use ngSwitch instead of router-outlet because lack of support @Input in router-outlet directive

I want to pass objects from a parent object to a child object, and I want to use router functionality. Because router-outlet has no support for @input I want to use ngSwitch. But I definitly need the router suport for protecting routes and so on and…
Ben
  • 594
  • 1
  • 9
  • 24
0
votes
3 answers

ng-switch not working even isactive is false

There are two buttons in ng-switch, if isActive is false, either one should show, but it is showing both buttons.what wrong i am doing?
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
0
votes
1 answer

Angular JS - adding a custom directive to an element with ng-switch-when directive

Using AngularJS 1.5, I've built a custom attribute directive, that adds a date-range-picker directive, and it's options, to the element : app.directive('clSingleDatePicker', function($compile) { var opts_single_date = { singleDatePicker:…
0
votes
1 answer

Can a switch be used to set HTML element attributes in Angular?

I've got some nice logic in an HTML element to switch an attribute value between 2 options using if: Do I have a similar option if I had more than 2 cases? I know I…
John VanZwieten
  • 427
  • 4
  • 12
0
votes
2 answers

Can you pass an array of values into an ngSwitch?

I have a functioning ngSwitch
Do 2
Do 4
Default
StatusIds can contain one or more…
Andrew Fraser
  • 78
  • 2
  • 9
0
votes
1 answer

Exposing $scope variable to ng-switch

Here is a small piece of code, where I am trying to render an HTML of my choice based on the "type" key of the json. Unfortunaltely, I don't see any error on executing the code nor am I getting the required HTML. I am very new to…
Amruthapv
  • 3
  • 5
0
votes
1 answer

Why ng-switch-when will not work when we use ng-controller?

I am a beginner to coding. Please help me in finding an issue in below code. In below code When i write ng-controller, all the 3 radio options are displayed and when i remove ng-controller then ng-switch-when works fine.
Choose any…
0
votes
3 answers

Angular *ngSwitchCase is not executing

I am new to Angular. I am using ngSwitch in my program but every time I run the program *ngSwitchDefault executes rather than *ngSwitchCase. Here is the code: