Answer the question
In order to leave comments, you need to log in
Why does the test change the value in the child scope and not in the current one?
There is an event handler
let orthography = $scope.appCTRL.orthography;
let url = attributes[DIRECTIVE];
element.on('keydown', (_event) => {
if (_event.keyCode == 13 && _event.ctrlKey) {
orthography.isOpen = true;
orthography.text = window.getSelection().toString().trim();
if (window.getSelection().focusNode) {
orthography.fragment = window.getSelection().focusNode.data;
}
}
});
document.body.innerHTML =
'<div data-ng-controller="appController" data-app-orthography="'+ urlOrthography +'" id="js-karma-test">' +
'<form class="modal-cross">' +
'<div class="modal-spelling__close" data-ng-click="appCTRL.orthography.isOpen = false">' +
'<i class="fa fa-times"></i>' +
'</div>' +
'<input type="text" value="бла бла бла" disabled="disabled">' +
'<textarea rows="10" cols="45" placeholder="Ваш комментарий" data-ng-model="appCTRL.orthography.comment">коммент</textarea>' +
'<input type="submit" value="Отправить" data-ng-click="appCTRL.orthography.onSubmit = true;">' +
'</form>' +
'</div>';
reCompileElementService.replace(angular.element(document.querySelectorAll('#js-karma-test')), scope);
scope.$digest();
angular.element(document.querySelector('#js-karma-test')).trigger({type: 'keydown', keyCode: 13, ctrlKey: true});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question