Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Item added in js code doesn't show in the list
Message
 
 
To
All
General information
Forum:
Javascript
Category:
Other
Title:
Item added in js code doesn't show in the list
Miscellaneous
Thread ID:
01607663
Message ID:
01607663
Views:
25
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
Reply
Map
View

Click here to load this message in the networking platform