The default ng-selected option fails to show up in the form POST without any modification

Within a select list, I have set one option to be selected by default using ng-selected. However, when submitting the form with the default option selected through the post method, it does not show up in the post variables. Interestingly, if I change the selection to another option and then back to the default, it works fine.

<select class="form-control" ng-model="newItem.if_unmard_rsn">
   <option value="Under age" ng-selected="'Under Age'">Under Age
   </option>
   <option value="Health Issue">Health Issue
   </option>
   <option value="Economical Issue">Economical Issue
   </option>
   <option value="No reason">No Reason
   </option>
</select>

Answer №1

attempt

<select class="form-control" ng-model="newItem.if_unmard_rsn" ng-init="newItem.if_unmard_rsn='Under Age'">
  <option value="Under age" >Under Age
  </option>
  <option value="Health Issue">Health Issue
  </option>
  <option value="Economical Issue">Economical Issue
  </option>
  <option value="No reason">No Reason
  </option>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for correctly displaying diacritics with Webpack and Typescript

While working on my project, I encountered an issue with diacritics marks (such as German or Polish characters) when using Webpack with Typescript. Unfortunately, the problem arises when trying to display these marks in the console or on a webpage. It seem ...

PHP - contact form is live for just 2 hours daily

Hello, this is my first time here and I could really use some assistance. Please bear with me as English is not my strong suit compared to most people here, but I'll do my best to explain my query. So, I have a PHP script for a contact form on my web ...

Is it possible to duplicate a response before making changes to its contents?

Imagine we are developing a response interceptor for an Angular 4 application using the HttpClient: export class MyInterceptor implements HttpInterceptor { public intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<an ...

ng-if behaving unexpectedly

This is a demonstration of how I populate the Table and attach checkboxes to a controller: <tr ng-repeat="key in queryResults.userPropNames"> <td><input type="checkbox" data-ng-checked="selectedKeys.indexOf(key) != -1 ...

When a two-sided object is rotated on the y-axis in THREE.js, the graphic vanishes into

class Game extends backbone.View constructor: -> @scene = new THREE.Scene() @camera = new THREE.PerspectiveCamera 75, window.innerWidth/window.innerHeight, 1, 100000 @camera.position.z = 300 @scene.add @camera ...

Trouble with Bootstrap modal implementation when using ajax and looping through data

I am having an issue with using the BS modal to display a form containing a select box and updating records in the database via an ajax call. The trigger button to open the modal consists of <i></i> tags with the same class name, itagbtn, and d ...

Iterate through the dates and append an object to the JSON data if it does not already exist

Creating a calendar view using fullcalendar.io requires generating JSON data in a specific format. The challenge lies in populating the calendar with price information for dates where data is missing from the database. To address this issue, the following ...

Does Mongoose use asynchronous saving?

Just starting out with mongoose and node. I'm trying to determine if the mongoose document.save method is asynchronous. Based on my observations, it seems to work even when not connected. Is there any way to know for sure when the document has been s ...

What is the process for invoking a property with a random approach?

I'm currently working on creating a quote generator using an object instead of an array. Although I can retrieve results, I seem to be getting the name of the quote rather than the actual quote itself. I attempted to use the bind method, but unfortu ...

Show a jQuery box when hovering and disappear when the mouse leaves

I'm currently working on creating a box that pops out when a link is hovered over. Although I have the basics covered, I've been struggling to fully achieve my desired outcome. You can view my progress here: http://jsfiddle.net/EpV87/1/ (please ...

Generating Interactive ng-models for Firebase Integration | Ionic Framework | Firebase Database | AngularJS

I am working on creating a new app feature that allows users to tag other registered users in a post. The concept is that when a user creates a new post, there will be a list of all available users with checkboxes next to each. The user can check off the ...

What is the best way to incorporate ui-select in a ui-bootstrap modal while utilizing Angular Formly?

Is there a way to incorporate ui-select in a ui-bootstrap modal when using Angular Formly? - This link provides an example, however it only includes input fields. ...

Is Valums Ajax file Upload capable of handling the uploaded file?

Currently, I am utilizing the Valums Ajax Fileupload script found at These are the settings I have configured: function createUploader(){ var uploader = new qq.FileUploader({ element: document.getElementById('file-uploader-de ...

Creating a dynamic pulse effect using jQuery to manipulate CSS box-shadow

My goal is to create a pulsating effect using CSS box-shadow through jQuery. Despite my best efforts, the code I attempted failed to produce the desired smooth pulse effect with box-shadow. The code snippet I experimented with: <div class="one"> &l ...

Tips for preventing flex items from having equal height when collapsing

When I try to place elements from an array in a list with display flex, the height of other elements gets modified when one is collapsed. I have attempted different display and inline placement on li elements but nothing has worked so far. Is there a way ...

Understanding the behavior of invoking higher order functions can be quite perplexing

I'm encountering an issue with invoking a function within another function. I can't figure out why I am unable to invoke a function using the following logic: function func1(futurefunc){ futurefunc(); } function func2(){ return 3+3; } func ...

`To activate/deactivate tabs by choosing options from drop-down menus`

Hey there, I'm currently dealing with a combo box that has 5 drop down items in Tab1. There are also other tabs present such as tab2, tab3, tab4, and tab5. Tab1 is enabled while the other tabs are disabled. Each of the disabled tabs contains different ...

Retrieve the values of multiple children nested within a parent JSON object

Within this JSON object snippet, I aim to extract the triggerid of each child object. While I can retrieve the first triggerid using the provided code line, var gettrigger = eventdata.result[0].relatedObject.triggerid; I am unsure how to gather the trig ...

Developing jasmine tests for an Angular directive

When implementing the directive below, it will check and load a template with either "pass", "fail", or "required" as values based on certain conditions. if(parent value == required){ 1. if the value is true -> $scope.msg = "fail" -> loads the templ ...

The E.js Template encountered an error with an unexpected token "else"

I am in the process of creating a website quickly using e.js & Express. However, I am encountering some problems when trying to use an if-else statement within e.js tags. The if statement works fine, but as soon as I add an else statement, things start t ...