FAQ Database Discussion Community


Getting Select box value in Angular - without using ng-options?

angularjs,angular-ngmodel
I'm trying to modify a form which is using a select box that is populate NOT using ng-options. The form itself is bound to an angular controller. Is there still a way for me to know the selected value of the select box even though the select values were not...

Select not selecting when binding with ng-model and ng-options

javascript,angularjs,select,angular-ngmodel,ng-options
Here's my select: <select class="form-control" ng-options="assistanceType as assistanceType.name for assistanceType in assistanceTypes" ng-model="selectedRecord.assistanceType"></select> Here's what I'm using to load the Assistance Types: $scope.getAssistanceTypes = function () { $http.get('/api/assistanceType/getAll'). success(function (data, status, headers, config) { $scope.assistanceTypes = data; }). error(function (data, status, headers, config) { alert(data.ExceptionMessage); }); } Here's the result:...

Angular js unbind and bind dynamically not working

angularjs,angular-ngmodel,ng-bind
I have an 2 inputs with ng-model and two elements binding the two models, I want that when I click on a button it switch the bindings i a way that element 1 binds model 2 and element 2 bind model 1, it work perfectly, but when start changing models...

Updating a value based on a range of inputs in AngularJS

javascript,angularjs,angularjs-ng-repeat,angular-ngmodel
What I am essentially trying to achieve here is to have a remaining amount that decreases in amount as the user enters the amount in to a series of text fields. These text fields are generated by an angular loop and its the remainingAmount var that I need to be...

ngOption default selected option

angularjs,angular-ngmodel,angular-services,angularjs-ng-options
How to have a default option in select box...I tried several options and do not get it I tried creating a scope on my contralador with the value of the object that comes from json: Like this: $scope.productSelect = $scope.item[0]; this my code: html: <select id="variant" class="form-control variant-select" ng-model="productSelect" ng-options="product...

AngularJS $scope values from ng-model lost from page to page in same controller - Ionic Framework

angularjs,angularjs-scope,ionic-framework,ionic,angular-ngmodel
I have this page which links the input.countNum scope variable to the input with ng-model. The value which is displayed on the button shows fine. When you click the button on the first page, it navigates to the second page which also displays the scope variable. But the variable is...

AngularJS Show List Items based on ng-model

angularjs,angular-ngmodel
I'm trying to create some functionality where the user would have an input box and all the data (li's) below are hidden. Then when a user types into the input box, those li's that match that text are show. What would the best way to do this using angular? I've...

angularjs: custom directive to check if a username exists

angularjs,angularjs-directive,angular-ngmodel
I have my registration form with textbox username. I want to do is when the user enter the username, the custom directive will check if the entered username is exists in the database. directives.js angular.module('installApp').directive('pwCheck', function ($http) { return { require: 'ngModel', link: function (scope, elem, attrs, ctrl) { elem.on('blur',...

ng-model throwing error on input type number in angular 1.3

javascript,angularjs,html5,angular-ngmodel
I have an input field which I want he user to input a number, so I have made an input field with type="number". When I use it in 1.2 I get no errors <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.27/angular.min.js"></script> <script> var app = angular.module('app', []); app.controller('MainCtrl', ['$scope', function ($scope) { $scope.person = [ {"name":...

Nested/embedded $resources in ngRepeats

angularjs,angularjs-ng-repeat,angular-ngmodel,angular-resource
My API populates some nested models. Using a shopping example, when you query orders, the items property is populated with the description and quantity instead of returning just the item IDs. orders: [ {_id: 1, items: [ {_id: 100, description: "apple", // from lookup in the Items table quantity: 4...

ng-model issue on logic

javascript,angularjs,angular-ngmodel
I have a little issue with an ng-model I am working on. First I will show the part where the ng-model is working properly <input type="text" ng-model="slip.risk" ng-change="riskWinCalculations(slip, 'RISKSTRAIGHT')"> <input type="text" ng-model="slip.win" ng-change="riskWinCalculations(slip, 'WINSTRAIGHT')"> <strong>To Win: </strong>{{straightTotalWin | currency}} <strong>Total Stake: </strong>{{straightTotalStake | currency}} now the html where the ng-model...

AngularJS adding incremental numbers to a select list

javascript,angularjs,angular-ngmodel,ng-options
I want a select box where I can choose from a list with a min/max number. Currently my number is just 1 to 10 so I have the below. <body ng-app="demoApp"> <div ng-controller="DemoController"> <select ng-model="selectedItem" ng-options="opt as opt for opt in options"> </select> The value selected is {{ selectedItem }}....

ng-options filter by value in another dropdown

angularjs,angular-ngmodel,ng-options
This seems to be a really straight forward code, but I cannot figure out why it is not working. I want to filter the 'model' dropdown by selected 'make', Make: <select ng-model="makeng" ng-options="option.display for option in makes"> <option ng-disabled="true" ng-selected="true" value="">Select a make</option> </select> Model: <select ng-model="modelng" ng-options="option.display for option...

Can't change select option item angular

javascript,json,angularjs,html-select,angular-ngmodel
I have a select option like this: <select ng-init="filterSelected = getItems.data.key" ng-model="filterSelected" ng-options="data.key as data.label for data in getItems.data" ></select> In which i parse a json that returns me some results that shows as item in this select. This is not a problem, i can display the items but i...

Having trouble using ngChange to update model

javascript,angularjs,angular-ngmodel,angularjs-ng-change,ng-controller
I just started learning the basics of Angular. I'm attempting to making an annual salary converter, just for fun. I'm having difficulty with my monthly ng-model updating when the yearly model is changed by the user. The fields are input tags. Here is the code <!doctype html> <html ng-app="salaryApp"> <head>...

Parsing data to ng-model not working

angularjs,angularjs-ng-repeat,angular-ngmodel
I'm trying to parse data to ng-model, but I'm getting an error. html: <div class="process-checkbox-holder" ng-repeat="time in data"> <div class="checkbox-title">{{ time.id }}</div> <div class="process-checkbox"> <input type="checkbox" ng-model="{{ time.model}}" value="None" id="process-checkbox" name="check"> <label for="process-checkbox"></label> </div> </div> data: $scope.data = [ {"id":"00", "model": "user.hourzero"}, {"id":"01", "model": "user.hourone"}, {"id":"03", "model":...

Angular query on mobile

javascript,angularjs,angular-ngmodel
Simply I am using ng-model="query" on my project as a search. It works great but for some reason it won't work on mobile (specifically iphone 5s). Is there any reason for this? I have tried searching for answers on google and haven't come up with anything.

Two inputs with one way binding in ng-model

javascript,angularjs,angularjs-directive,angularjs-scope,angular-ngmodel
I try to make an application which have two inputs text (say parent and child) , each one has ng-model . I want to make it one way binding , mean , change in the parent input should display the same value in the child , and change in the...

angularjs update model based on sum of other fields

javascript,angularjs,angular-ngmodel
I want to be able to update a value in my data model based on the result of two other fields. using <td><input ng-value="s.hours*s.rate"></td> I have no problem calculating the result but how am I able to bind it to toal? eg I tried <td><input ng-model="s.total" ng-value="s.hours*s.rate"></td> but the model...

AngularJS update ng-model if value = true

javascript,angularjs,angular-ngmodel
Hello I'm building an app that overviews data from a database. I have a form which loads that information with ng-model into input fields, The user have the option to change these values. However I dont want the values on the overview to live update when the user changes the...

Using ng-model with select to show data attribute instead of value?

javascript,html,angularjs,angular-ngmodel
I currently have a simple select list that contains both data attributes and a value: <select ng-model="myList"> <option value="1" data-name="Test name 1">Option 1</option> <option value="2" data-name="Test name 2">Option 2</option> <option value="3" data-name="Test name 3">Option 3</option> </select> <div id="displaySelected"> {{myList}} </div> Inside my div (with the ID of displaySelected), it is...

Change selected