FAQ Database Discussion Community


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...

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>...

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...

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...

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.

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',...

How to populate table with json data using angular?

javascript,json,angularjs,angular-ngmodel
I have loaded the json data successfully via http but having a problem populating a table with this json data based on the entered value 'name'. Plunker Below. Plunker json [ { "name": "Tim", "address": "Road", "phone": "1234", "status": "busy" }, { "name": "Sue", "address": "Street", "phone": "4321", "status": "available"...

ng-model in select box is not working correctly

javascript,angularjs,angular-ngmodel
I am using angular js to draw select boxes. <select ng-model="selected"> <option value="{{obj.id}}" ng-repeat="obj in values">{{obj.name}} </option> </select> selected id - {{selected}} Here the default selected is not initialized according to value selected. Have made a fiddle for the problem....

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":...

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...

pass the ng-model value to angular directive

javascript,angularjs,angularjs-directive,angular-ngmodel
I have a scenario where I have certain number of text-boxes and when I click on any of the text-box, its corresponding ng-model is to be printed on the browser console. I have written the following angular code: <html ng-app="myApp"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0-beta.0/angular.min.js"></script> <script> var app = angular.module("myApp", []) app.controller("myAppCtrl",...

ngModel Changing to Child Scope

angularjs,angular-ngmodel
When I edit a value through an input field that is bound (perhaps bound isn't the right term) to a parent controller's scope, it seems to re-bind to the child controller's scope. This eliminates my ability to affect the value with functions built into the parent scope (clicking the button...

AngularJS - Directive ngModel doesn't get updated

angularjs,angularjs-directive,angular-ngmodel
I have a good understanding of AngularJS Directives, but I'm thinking I'm missing something here with my directives. What's wrong : On the initial page load, the ngModel gets triggered correctly and I successfully receive the data and it's modeled in the input. Everything I do after... doesn't work. If...

Angular JS ng-model not initiating properly for the first time

javascript,angularjs,angular-ngmodel
I am using Angular JS ng-model to track the selected value of the select tag. here's the example http://jsfiddle.net/8853oxb1/3/ function ControllerA($scope) { $scope.optionsArray = [1,2,3,4,5]; $scope.optionsObject = {"India" : "IN" , "Singapore" : "SG", "Malaysia" : "MY", "Indonesia" : "INDY"}; } If, I go to a dropdown by using a...

How to track behavior of ngModel array item using .directive

javascript,angularjs,directive,watch,angular-ngmodel
Hi everyone I'm use angularjs not so long time ago and now I have one issue related with this framework that i can't to solve. So the problem in next: I have few input fields that generate via ng-repeat: <div class="form-group" ng-repeat="(i, name) in name_list track by $index"> <div class="row">...

Angular Js ng-model not updating variable in an inner function

angularjs,angular-ngmodel
I have the following code in my controller: appControllers.controller('myCtrl', [ '$scope', function($scope) { $scope.timeFreeze = false; $scope.ws = new WebSocket("ws://localhost:8080/ws"); $scope.ws.onopen = function() { $scope.ws.send('{...}'); }; $scope.ws.onmessage = function (evt) { var received_msg = JSON.parse(evt.data); //...do something with the data... console.log($scope.timeFreeze); // This is ALWAYS false!!! Why? if ( $scope.timeFreeze...

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...

Specifying Angular ngModel Value with ng-repeated options

javascript,angularjs,angularjs-scope,angularjs-ng-repeat,angular-ngmodel
I've got a select dropdown, whose options are being ng-repeated out of an object called $scope.bars. However, my ng-model, which is set to a sub-value of $scope.bars, is not correctly choosing an option. Instead, the select box is blank by default, indicating an 'undefined' value. Here's my HTML: <div ng-app="programApp"...

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...

Change selected