angularjs - ng_change doesn't copy time value of angular-moment-picker into other fields -
i have dynamically generated form time field filled in angular-moment-picker. want value copied other time fields using function assigned ng_change. function not called input field includes ng_change. when don't use moment-picker value copied without issues. input field:
@html.textboxfor(model => model.mymodels.model[i].time, new { @class = "form-control", ng_model = "model_time" + (i + 1), ng_change = "copytime(" + (i + 1) + ")", moment_picker = "model_time" + (i + 1), format = "lt", locale = "nl", ng_model_options = "{ updateon: 'blur' }", set_on_select = true }) copy function:
$scope.copytime = function (index) { console.log("check if function called"); $scope.model_time2 = $scope.model_time1; $scope.model_time3 = $scope.model_time1; $scope.model_time4 = $scope.model_time1; };
according docs, has own function called change:
@html.textboxfor(model => model.mymodels.model[i].time, new { change = "copytime(" + (i + 1) + ")" // ... }) that said, if angular-moment using ngmodelcontroller underneath update model, i'd have expected ng-change work since invoked automatically once model has changed. maybe doesn't play nice ng-model-options?
Comments
Post a Comment