We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Angular-CLI Cannot find name 'ej'

I have created new application using angular CLI as Abinaya Subbiah described here: https://www.syncfusion.com/forums/127630/how-to-work-with-angular-cli
I have typings installed in my package.json:
"devDependencies: {
...
"@types/ej.web.all": "^15.1.4" //I have tried version "^0.0.1" - didn't help
}

I try to use "ej" namespace to configure my ej-grid (ej.Grid.SummaryType.Sum)

When I try to start my application it throws an error "Cannot find name 'ej'".

How should I install typings for my Angular CLI appliacion?

12 Replies

MS Mani Sankar Durai Syncfusion Team April 24, 2017 12:35 PM UTC

 
Hi mujef, 
 
                                                               
Thanks for contacting Syncfusion support. 
 
 
We suspect that the issue occurred due to typings not installed properly in the sample. In some system environment typings will not be installed properly, so please ensure typings are installed properly in the application as like the below screenshot.  
   
       
  
  • To install Syncfusion JavaScript and Angular 2 components run below commands from sample’s root folder. 
   
npm install --save-dev @types/ej.web.all   
   
    
·         Now the typings will be installed properly.    
 
If you still face the issue please get back to us with the following details. 
1.       Share the screenshot/video of the issue that you have faced 
2.       If possible share the sample with issue reproducing. 
 
The provided information will help us to analyze the issue and provide you the response as early as possible. 
  
Please let us know if you need further assistance 

Regards, 
Manisankar Durai. 



MU mujef April 24, 2017 12:44 PM UTC

I have ej.web.all typings in node_modules folder - exactly like on your screenshot.
npm install command didn't help.
When I try to start my appliaction angular cli shows "Cannot find name 'ej'" in file where I use it.
The same error is displayed in the browser when I open my application address.


MU mujef April 24, 2017 02:24 PM UTC

To reproduce the issue:
1) create new app as described On March 8, 2017 01:37 AM in https://www.syncfusion.com/forums/127630/how-to-work-with-angular-cli
2) in app.component.ts create
test () {
   const a = ej.DataManager;
}
3) run ng serve --aot false


MS Mani Sankar Durai Syncfusion Team April 25, 2017 01:29 PM UTC

Hi mujef, 

We have analyzed your query and we are able to reproduce the reported issue. We suspect that the ej.web.all in types will be referred before the jquery rendered in tsconfig.app. So this issue occurs. To avoid this we suggest you to change the ej.web.all after the jquery renders in your tsconfig.app file. 
Note: tsconfig.app JSON file will be located in src folder of your project file. 

Refer the code example. 
[tsconfig.app] 
 
{ 
  "compilerOptions": { 
    "sourceMap": true, 
    "declaration": false, 
    "moduleResolution": "node", 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "lib": [ 
      "es2016", 
      "dom" 
    ], 
    "outDir": "../out-tsc/app", 
    "target": "es5", 
    "module": "es2015", 
    "baseUrl": "", 
    "typeRoots": [ 
      "node_modules/@types/" 
    ], 
    "types": [ 
      "jquery", 
      "ej.web.all", 
      "node", 
      "es6-shim" 
    ] 
  }, 
  "exclude": [ 
    "test.ts", 
    "**/*.spec.ts" 
  ] 
} 
 


We have also prepared a sample that can be downloaded from the below link 

If you still face the issue please share us the following details. 
1.       Share the code example. 
2.       Share the screenshot of the issue with stack trace 
3.       If possible share the sample with issue reproducing. 
The provided information will help us to analyze the requirement and provide you the response as early as possible. 

Please let us know if you need further assistance. 

Regards, 
Manisankar Durai. 



FL Flavio October 27, 2017 12:50 PM UTC

I have the same problem here, Im just trying the Schedule component.

I have installed and configured everything, that is working fine, but when I use "ej." it throw an error.