my problem is that after change input value by code or any plugin new value not submitted to controller and old value of property is accessible. but if change input value by typing new value is available! only by typing! template :
<input class="form-control" id="ng-taskLineBackColor"
type="text" ng-model="data.preference.lineBackColor"/>
<input type="submit" ng-click="update()" class="btn btn-primary" value="save"/>
controller :
.controller('taskCtrl', ['$scope', function ($scope) {
$scope.getRef = function () {
return //any code
};
$scope.save = function () {
var newValue = $scope.data.preference.lineBackColor;
//!!!-->newValue Contain old Value
};
}])
Any code which changes the value of ng-taskLineBackColor needs to trigger a special event called "input". This will notify AngularJS
$(function() {
$('#ng-taskLineBackColor').val('new value').trigger('input');
});
To do this only with jQlite and without jQuery try:
angular.element(document.querySelector('#ng-taskLineBackColor')).triggerHandler('input')
And here's the API you have available on an angular.element
-wrapped HTML element:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With