10 examples of 'angular enter key event' in JavaScript

Every line of 'angular enter key event' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
65function enterKeyHandler (evt, state) {
66 if (evt.which !== 13) {
67 // Not enter
68 clearNewline = false
69 return
70 }
71
72 evt.preventDefault()
73 var lf = state.before.lastIndexOf('\n') + 1
74 var previousLine = state.before.slice(lf)
75 var indentMatch = previousLine.match(indentRegexp) || ['']
76 if (clearNewline && !state.selection && state.before.length === lastSelection) {
77 state.before = state.before.substring(0, lf)
78 state.selection = ''
79 clearNewline = false
80 fixNumberedList(state, indentMatch[1])
81 return true
82 }
83 clearNewline = false
84 var indent = indentMatch[0]
85 if (indent.length) {
86 clearNewline = true
87 }
88
89 clEditorSvc.cledit.undoMgr.setCurrentMode('single')
90
91 state.before += '\n' + indent
92 state.selection = ''
93 lastSelection = state.before.length
94 fixNumberedList(state, indentMatch[1])
95 return true
96}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

57public keyupEnterHandler(event: KeyboardEvent) {
58 if (Key.Util.isEnter(event.keyCode)) {
59 this.setValue();
60 }
61}
91function handleKeyUpEvent(event) {
92 //console.log('keyup');
93 if (!$scope.disabled() && opened && event.keyCode === 27) {
94 $scope.$apply(function() {
95 close(ContextMenuService.menuElement);
96 });
97 }
98}
86function keyDown(e) {
87 if (e.keyCode == 87 || e.keyCode == 38) {//Arrow Up
88 this.keys.up = 1;
89
90 }else if (e.keyCode == 83 || e.keyCode == 40) {//Arrow Down
91 this.keys.down = 1;
92
93 } else if (e.keyCode == 65 || e.keyCode == 37) {//Arrow Left
94 this.keys.left = 1;
95
96 } else if (e.keyCode == 68 || e.keyCode == 39) {//Arrow Right
97 this.keys.right = 1;
98 }
99}
34onkey(event: KeyboardEvent) {
35 if (event.metaKey || event.shiftKey || event.ctrlKey || event.altKey) return;
36 if (event.type == 'keyup') {
37 if (event.key == 'Escape' && document.activeElement.outerHTML == this.inputfield.outerHTML) {
38 this.inputfield.blur()
39 }
40 if (event.key == '/' && document.activeElement.tagName != 'INPUT') {
41 this.inputfield.focus()
42 }
43 }
44 if (event.type == 'keydown' && document.activeElement.tagName != 'INPUT') {
45 if (event.code.startsWith('Key')) {
46 this.inputfield.focus()
47 this.query = (this.query || '') + event.key
48 }
49 }
50}
269function simulateKeydown(code) {
270 var e = jQuery.Event("keydown");
271 e.keyCode = code;
272 jQuery('body').trigger(e);
273}
36function keydown(e) {
37 if (e.ctrlKey && e.keyCode == 83) {
38 e.preventDefault()
39 save()
40 }
41}
23private _keydownHandler(event: SyntheticEvent<KeyboardEvent>): void {
24 const keys = this._options.stopKeys || [];
25
26 if (keys.find((key) => key.keyCode === event.nativeEvent.keyCode)) {
27 event.stopped = true;
28 }
29}
119_enterKeyPressed(event) {
120 event.consume(true);
121
122 this._prompt.clearAutocomplete();
123
124 var query = this._prompt.text();
125 if (!query.length)
126 return;
127
128 this._prompt.setText('');
129
130 this.database.executeSql(query, this._queryFinished.bind(this, query), this._queryError.bind(this, query));
131}
41keydown(event) {
42 switch (event.keyCode) {
43 case 40:
44 this.downArrowPressed = true;
45 break;
46 case 13: {
47 if (!this.downArrowPressed) {
48 this.submit.emit();
49 event.stopPropagation();
50 const self = this;
51 setTimeout(function () {
52 self.txtInput.nativeElement.value = self.searchText;
53 }, 100);
54 }
55 }
56 }
57}

Related snippets