Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Item added in js code doesn't show in the list
Message
 
 
À
Tous
Information générale
Forum:
Javascript
Catégorie:
Autre
Titre:
Item added in js code doesn't show in the list
Divers
Thread ID:
01607663
Message ID:
01607663
Vues:
26
Hi everybody,

I return an object to my controller code. In C# I have the following:
   [Route("metadata")]
        public IHttpActionResult GetMetaData()
        {            
            var itemTrees = _itemTreeAdapter.GetAll().Select(it=> new {id = it.NodeId, Descrip = it.Descrip}).OrderBy(it=>it.Descrip);            
            
            

            return Ok(new
                {ItemTrees = itemTrees
            });
        }
So, I thought I'd try adding an extra option in the js code using the following code:
  var defaultOption =  [{ id: 0, descrip: 'Select Item Tree...' }];
                        $scope.metaData.itemTrees.splice(0, 0, defaultOption);
I can see that the item is added fine, but for some weird reason this option is not shown up in the list of options!!!

Same happens if instead of
 <select class="form-control" ng-model="currentSalespoint.iTreeTop"
                            ng-options="t.id as t.descrip for t in metaData.itemTrees">
                       <option value="">Select Item Tree...</option>
                    </select>
I try to use option value = "0". In this case that option is not shown in the list of options. Do you know why?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Répondre
Fil
Voir

Click here to load this message in the networking platform