• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ckeditor / ckeditor5-angular / 742

pending completion
742

cron

travis-ci-com

pomek
Release: v6.0.1.

38 of 38 branches covered (100.0%)

Branch coverage included in aggregate %.

157 of 157 relevant lines covered (100.0%)

25.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/app/demo-reactive-form/demo-reactive-form.component.ts
1
import type {
2
        AfterViewInit
3
} from '@angular/core';
4
import {
5
        Component
6
} from '@angular/core';
7

8
import type { AbstractControl } from '@angular/forms';
9
import { FormGroup, FormControl } from '@angular/forms';
10

11
import AngularEditor from '../../../ckeditor/build/ckeditor';
12

13
@Component( {
14
        selector: 'app-demo-reactive-form',
15
        templateUrl: './demo-reactive-form.component.html',
16
        styleUrls: [ './demo-reactive-form.component.css' ]
17
} )
18
export class DemoReactiveFormComponent implements AfterViewInit {
1✔
19
        public Editor = AngularEditor;
4✔
20

21
        public demoReactiveForm = new FormGroup( {
4✔
22
                name: new FormControl( 'John' ),
23
                surname: new FormControl( 'Doe' ),
24
                description: new FormControl( '<p>A <b>really</b> nice fellow.</p>' )
25
        } );
26

27
        public formDataPreview?: string;
28
        public shouldDisableTwoWayDataBinding = false;
4✔
29

30
        public editorInstance?: AngularEditor;
31

32
        public toggleDisableTwoWayDataBinding(): void {
33
                this.shouldDisableTwoWayDataBinding = !this.shouldDisableTwoWayDataBinding;
1✔
34
        }
35

36
        public ngAfterViewInit(): void {
37
                this.demoReactiveForm!.valueChanges
4✔
38
                        .subscribe( values => {
39
                                this.formDataPreview = JSON.stringify( values );
3✔
40
                        } );
41
        }
42

43
        public onReady( editor: AngularEditor ): void {
44
                this.editorInstance = editor;
2✔
45
        }
46

47
        public onSubmit(): void {
48
                // Read editor's data only when two-way data binding is disabled
49
                if ( this.shouldDisableTwoWayDataBinding ) {
2✔
50
                        this.demoReactiveForm.value.description = this.editorInstance!.getData();
1✔
51
                }
52

53
                console.log( 'Form submit, model', this.demoReactiveForm.value );
2✔
54
        }
55

56
        public reset(): void {
57
                this.demoReactiveForm!.reset();
1✔
58
        }
59

60
        public get description(): AbstractControl {
61
                return this.demoReactiveForm!.controls.description;
50✔
62
        }
63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc