Posts

Showing posts with the label angular

Angular

Angular Service An angular service can be provided in a module definition. It can also be provided using a decorator @Injectable({ providedIn: 'root', }) Using a decorator has the advantage of being tree shakable.  List of built in services https://angular.io/api?type=class  Example of listening to custom event: @HostListener('hide.bs.modal') modalClosing() { ... } Adding Bootstrap.js to angular https://stackoverflow.com/a/39693770/2671663 Angular schematics can upgrade your code to a major version https://app.pluralsight.com/course-player?clipId=b637bf82-7975-4e02-8d50-31a76f7ecfdc Programmatically setting selected option: <select [formControl]='selectControl'> <option [ngValue]=null>Select An Option</option> <option *ngFor="let f of comms" [value]="f.GUID">{{f.Name}}</option> </select> Then in the component selectControl: FormControl = new FormControl(); ..... this.se...

Adding CKEditor 4 to Angular

You can add CKEditor 4 to angular following instruction from here . Add ckeditor using npm: npm install ckeditor4-angular After installing, import CKEditorModule to your application: import { CKEditorModule } from 'ckeditor4-angular'; @NgModule( { imports: [ ... CKEditorModule, ... ], … } ) Use the  CKEditor 4 online builder to quickly customize and generate ckeditor files. Unzip the generated file and copy the ckeditor folder into your projects assets folder.  In index.html, add a script reference to ckeditor: <script src="assets/ckeditor/ckeditor.js"></script> Then in a component, you can use ckeditor like this: <ckeditor data="<p>Hello, world!</p>"></ckeditor>