FAQ Database Discussion Community


AngularJS assign values to items in ng-repeat array using ng-model and retrieve those values

arrays,angularjs,angularjs-ng-repeat,angular-ngmodel
ok so this is turning out to be a little harder than expected. i have two arrays one for products and one for options. where the problem starts is when i try to give each product its own options array with its own scope, meaning when one option is selected...

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

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

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

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

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

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

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

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

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

Change selected