with Angular4, TypeError: Cannot read property 'imports' of undefined
See original GitHub issuei tried to add the ImageResize module to the ng2-quill-editor component,
import * as Quill from 'quill';
import ImageResize from 'quill-image-resize-module';
Quill.register('modules/imageResize', ImageResize);
and added
ImageResize: {
modules: ['Resize', 'DisplaySize', 'Toolbar']
}
to the options inside the component, but am getting
image-resize.min.js:1 Uncaught TypeError: Cannot read property ‘imports’ of undefined at Object.<anonymous> (image-resize.min.js:1)
any idea how to solve this error ?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:14
Top Results From Across the Web
Getting 'Cannot read property 'ɵmod' of undefined' when ...
Simply just return the module. { path: 'auth', loadChildren: () => import('./auth/auth.module') .then((a) => { return a.AuthModule; }); },.
Read more >uncaught typeerror: cannot read properties of undefined ...
core.js:34469 Uncaught TypeError: Cannot read property 'id' of undefined at registerNgModuleType. If I in my appName.module.ts remove from imports.
Read more >Cannot read property 'correlationdepthunits' of undefined
You need to make sure that which ever variables throws undefined error, has an assigned value. JavaScript. function test(t) { // ...
Read more >Cannot read properties of undefined (reading 'title') 2 - Angular
by all means // product-form.component.ts import { Component, OnDestroy, OnInit } from '@angular/core'; import { ActivatedRoute, ...
Read more >TypeError: Cannot read property 'imports' of undefined
TypeError : Cannot read property 'imports' of undefined ... :wave: I was able to compile your code and migrate. Can you share the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We had the same issue on Angular 4 using the cli. We got it to work by including the minified scripts from the package in angular-cli.json:
Then have a service for our editor initialization/functionality (though you could probably also just do this on a component). We declared the Quill const at the top of the file to make typescript happy:
declare const Quill: any;
Quill will already be available globally because it’s in the ‘scripts’ array in angular-cli.json. Then, we just created our editor instance and include imageResize:
Call ‘configureQuill()’ on the afterViewInit hook to make sure your DOM element exists, and it seems to work. The disadvantage is that Quill is loaded globally- we only need it for a couple components, so it would be nice to just be able to import it in those, but we ran into the same issues as others in this thread when trying that route.
People who are having difficulty using the quill image resize module with ANGULAR-CLI e ANGULAR 2+ Here’s a way to not have to tinker with the webpack.config.ts file
terminal
angular-cli.json
Componente.ts
Componente.html
<quill-editor [modules]="editor_modules" [(ngModel)]="content"></quill-editor>