Answer the question
In order to leave comments, you need to log in
Why is ng-blur not working?
<div class="compliteinfo">
<div ng-repeat="field in $ctrl.fields">
<div class="input-field col s12" ng-if=" field.type === 'textarea' ">
<textarea id="field-{{field.id}}" class="materialize-textarea">
</textarea>
<label for="field-{{field.id}}">{{ field.title }}</label>
</div>
<div class="input-field col s12" ng-if=" field.type === 'textfield' " >
<input type="text" ng-blur="$ctrl.saveData">
<label for="field-{{field.id}}">{{ field.title }}</label>
</div>
</div>
</div>
export default ($scope, $element, $attrs) => {
let entity = $scope.$ctrl.data;
let { executeEvents } = $Registry;
let processStepId = entity.processstepid;
let entityid = entity.entityId;
let idInPool = entity.idInPool;
executeEvents.requestWidgets({
'name': 'none',
'sendObject': {'entityGet': [processStepId, entityid, idInPool]},
'mycallback': function(answer){
let data = answer.data;
console.log(data)
$scope.$ctrl.fields = data.fields; // сюда занесли свои элементы и они выводятся
}
});
$scope.$ctrl.saveData = function() {alert('так тоже не работает');}
$scope.saveData = function(){
console.log("saveData")
alert(1)
}
}
Answer the question
In order to leave comments, you need to log in
Note: As the blur event is executed synchronously also during DOM manipulations (eg removing a focussed input), AngularJS executes the expression using scope.$evalAsync if the event is fired during an $apply to ensure a consistent state.
$scope
. Accordingly, Angular tries to call $scope.alert()
, not window.alert
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question