ng-model no longer updates after typing into text input

your link requires a login. if i have to guess about your problem, it may be related to angular scoping issue. try changing your ng-model binding to an object property instead. so in your html, instead of: <input type=”text” id=”form_course_name” ng-model=”edit_course_name”> do this <input type=”text” id=”form_course_name” ng-model=”course.edit_course_name”> and in your javascript, on the ajax callback, … Read more

Setting ngTrueValue and ngFalseValue to numbers

You can use ngChecked, If the expression is truthy, then special attribute “checked” will be set on the element <input type=”checkbox” ng-model=”checkbox” ng-true-value=”1″ ng-false-value=”0″ ng-checked=”checkbox == 1″ /> And you can use $scope.$watch to convert it to number $scope.$watch(function(){ return $scope.checkbox; }, function(){ $scope.checkbox = Number($scope.checkbox); console.log($scope.checkbox, typeof $scope.checkbox); },true); DEMO

Angular2: use [(ngModel)] with [ngModelOptions]=”{standalone: true}” to link to a reference to model’s property

Using @angular/forms when you use a <form> tag it automatically creates a FormGroup. For every contained ngModel tagged <input> it will create a FormControl and add it into the FormGroup created above; this FormControl will be named into the FormGroup using attribute name. Example: <form #f=”ngForm”> <input type=”text” [(ngModel)]=”firstFieldVariable” name=”firstField”> <span>{{ f.controls[‘firstField’]?.value }}</span> </form> Said … Read more

How can I make angularjs ngChange handler be called only when user finishes typing

Use ng-model-options in Angular > 1.3 <input type=”text” ng-model=”vm.searchTerm” ng-change=”vm.search(vm.searchTerm)” ng-model-options=”{debounce: 750}” /> Without ng-model-options — In markup: <input ng-change=”inputChanged()”> In your backing controller/scope var inputChangedPromise; $scope.inputChanged = function(){ if(inputChangedPromise){ $timeout.cancel(inputChangedPromise); } inputChangedPromise = $timeout(taskToDo,1000); } Then your taskToDo will only run after 1000ms of no changes.

AngularJs – ng-model in a SELECT

You can use the ng-selected directive on the option elements. It takes expression that if truthy will set the selected property. In this case: <option ng-selected=”data.unit == item.id” ng-repeat=”item in units” ng-value=”item.id”>{{item.label}}</option> Demo angular.module(“app”,[]).controller(“myCtrl”,function($scope) { $scope.units = [ {‘id’: 10, ‘label’: ‘test1’}, {‘id’: 27, ‘label’: ‘test2’}, {‘id’: 39, ‘label’: ‘test3’}, ] $scope.data = { ‘id’: … Read more

angular 6 warning for using formControlName and ngModel

Now you can find the documentation here: https://angular.io/api/forms/FormControlName#use-with-ngmodel-is-deprecated So you have 3 options: use Reactive forms use Template driven forms silence warning (not recommended) <!– language: lang-ts –> imports: [ ReactiveFormsModule.withConfig({warnOnNgModelWithFormControl: ‘never’}); ]

Angular bootstrap datepicker date format does not format ng-model value

Although similar answers have been posted I’d like to contribute what seemed to be the easiest and cleanest fix to me. Assuming you are using the AngularUI datepicker and your initial value for the ng-Model does not get formatted simply adding the following directive to your project will fix the issue: angular.module(‘yourAppName’) .directive(‘datepickerPopup’, function (){ … Read more