How to work with Angular CLI
Then, I did what https://www.npmjs.com/package/ej-angular2 says)ng new my-ej-appcd new my-ej-app
npm install ej-angular2 --save
To generate all *.js, *.js.map and *.d.ts files:$ npm run tscTo lint all *.ts files:$ npm run lint
npm ERR! missing script: tsc
// Import the library moduleimport { EJAngular2Module } from 'ej-angular2';
<button class="btn btn-primary" (click)="openSimpleDialog()"></button>
<ej-dialog id="basicDialog" title="Dialog">This is a simple dialog</ej-dialog>
ERROR in Error encountered resolving symbol values statically. Calling function 'EJAngular2Module', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /Users/janbranny/Documents/Projects/jb/jb.NG2/my-app/src/app/app.module.ts, resolving symbol AppModule in /Users/janbranny/Documents/Projects/jb/jb.NG2/my-app/src/app/app.module.ts
|
npm install -g [email protected]
|
|
npm install [email protected] --save
|
our latest Syncfusion Angular 2 components [..] support Angular 2 version 2.4.0
ng new ej-ng2-app
cd ej-ng2-app
npm install [email protected] --save
ERROR in Error encountered resolving symbol values statically. Calling function 'EJAngular2Module', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/projects/angular2/ej-ng2-app/src/app/app.module.ts, resolving symbol AppModule in ./ej-ng2-app/src/app/app.module.ts webpack: Failed to compile.
It is not connected with auto compilation with sample changes. If you create new application as Alexander Heim described you will see the problem.
Your seed application uses webpack (standalone), not angular-cli.
Regards
M.
"[..] edit and resave any component file [..]"My example did not even have a real component file other than the dummy, autogenerated app.component. Try to include your EJAngular2 module in app.module and you'll see, it's impossible. Whether or not you save and refresh any file - it does not help.
|
ng serve --aot false |
|
ng serve --aot false |
- Install angular-cli globally and create getting started sample with below commands.
|
npm install -g @angular/cli@latest
ng new [PROJECT_NAME]
cd [PROJECT_NAME]
ng serve --aot false |
- To install Syncfusion JavaScript and Angular 2 components run below commands from sample’s root folder.
|
npm install syncfusion-javascript --save
npm install ej-angular2 --save
npm install --save-dev @types/jquery
npm install --save-dev @types/ej.web.all |
- Import EJAngular2Module from ej-angular2 package to import Angular 2 components into the project. Refer to the below code snippets to import Syncfusion Angular 2 components.
|
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { EJAngular2Module } from 'ej-angular2';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
EJAngular2Module.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { } |
- Refer Syncfusion controls dependencies script and css files from node_modules in angular-cli.json file script and styles section. Refer to the below code snippet.
|
{
"project": {
"name": "clisample"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css",
"./../node_modules/syncfusion-javascript/Content/ej/web/material/ej.web.all.min.css"
],
"scripts": [
"./../node_modules/jquery/dist/jquery.min.js",
"./../node_modules/jsrender/jsrender.min.js",
"./../node_modules/syncfusion-javascript/Scripts/ej/web/ej.web.all.min.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
} |
- Now, navigate to root of the application and run the application using ng serve and navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
|
ng serve --aot false |
ERROR in Error encountered resolving symbol values statically. Calling function 'EJAngular2Module', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/projects/angular2/sf2/src/app/app.module.ts, resolving symbol AppModule in C :/projects/angular2/sf2/src/app/app.module.ts
WARNING in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader!./~/syncfusion-javascript/Content/ej/web/material/ej.theme.min.css autoprefixer: C:\projects\angular2\sf2\node_modules\syncfusion-javascript\Content\ej\web\material\ej.theme.min.css:10:330880: Gradient has outdated direction syntax. New syntax is like `to left` instead of `right`.@ ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader!./~/syncfusion-javascript/Content/ej/web/material/ej.web.all.min.css 4:10-157@ ./~/syncfusion-javascript/Content/ej/web/material/ej.web.all.min.css@ multi ./src/styles.css ./~/syncfusion-javascript/Content/ej/web/material/ej.web.all.min.css
PS C:\Users\kevin\Downloads\cli-sample2072672477> ng serve --aot false
** NG Live Development Server is running on http://localhost:4200 **
Hash: 2b1e00b5a607546287bd
Time: 18731ms
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 153 kB {5} [initial] [rendered]
chunk {1} styles.bundle.js, styles.bundle.js.map (styles) 926 kB {5} [initial] [rendered]
chunk {2} scripts.bundle.js, scripts.bundle.js.map (scripts) 11.4 MB {5} [initial] [rendered]
chunk {3} main.bundle.js, main.bundle.js.map (main) 4.2 kB {4} [initial] [rendered]
chunk {4} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.93 MB [initial] [rendered]
chunk {5} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
WARNING in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader!./~/syncfusion-javascript/Content/ej/web/material/ej.theme.min.css
autoprefixer: C:\Users\kevin\Downloads\cli-sample2072672477\node_modules\syncfusion-javascript\Content\ej\web\material\ej.theme.min.css:10:330880: Gradient has outdated direction syntax. New syntax is like `to left` instead of `right`.
@ ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader!./~/syncfusion-javascript/Content/ej/web/material/ej.web.all.min.css 4:10-157
@ ./~/syncfusion-javascript/Content/ej/web/material/ej.web.all.min.css
@ multi ./src/styles.css ./~/syncfusion-javascript/Content/ej/web/material/ej.web.all.min.css
ERROR in Error encountered resolving symbol values statically. Calling function 'EJAngular2Module', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/Users/kevin/Downloads/cli-sample2072672477/src/app/app.module.ts, resolving symbol AppModule in C:/Users/kevin/Downloads/cli-sample2072672477/src/app/app.module.ts
webpack: Failed to compile.
I've just tried again using given instructions, and got the same error above. Is there anything else I missed?
The full logs as below. Code also attached.
D:\Samples\Frontend\Syncfusion>ng new ej-ng-app1
installing ng
create .editorconfig
create README.md
create src\app\app.component.css
create src\app\app.component.html
create src\app\app.component.spec.ts
create src\app\app.component.ts
create src\app\app.module.ts
create src\assets\.gitkeep
create src\environments\environment.prod.ts
create src\environments\environment.ts
create src\favicon.ico
create src\index.html
create src\main.ts
create src\polyfills.ts
create src\styles.css
create src\test.ts
create src\tsconfig.app.json
create src\tsconfig.spec.json
create src\typings.d.ts
create .angular-cli.json
create e2e\app.e2e-spec.ts
create e2e\app.po.ts
create e2e\tsconfig.e2e.json
create .gitignore
create karma.conf.js
create package.json
create protractor.conf.js
create tsconfig.json
create tslint.json
Successfully initialized git.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Project 'ej-ng-app1' successfully created.
D:\Samples\Frontend\Syncfusion>cd ej-ng-app1
D:\Samples\Frontend\Syncfusion\ej-ng-app1>npm install syncfusion-javascript --save[email protected] D:\Samples\Frontend\Syncfusion\ej-ng-app1
| `-- [email protected]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
D:\Samples\Frontend\Syncfusion\ej-ng-app1>npm install ej-angular2 --save[email protected] D:\Samples\Frontend\Syncfusion\ej-ng-app1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
D:\Samples\Frontend\Syncfusion\ej-ng-app1>npm install --save-dev @types/jquery[email protected] D:\Samples\Frontend\Syncfusion\ej-ng-app1
`-- @types/[email protected]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
D:\Samples\Frontend\Syncfusion\ej-ng-app1>npm install --save-dev @types/ej.web.all[email protected] D:\Samples\Frontend\Syncfusion\ej-ng-app1
`-- @types/[email protected]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
D:\Samples\Frontend\Syncfusion\ej-ng-app1>code .
D:\Samples\Frontend\Syncfusion\ej-ng-app1>ng serve --aot false** NG Live Development Server is running on http://localhost:4200 **
Hash: 0be052d37f3d5f2f54b9
Time: 18130ms
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 157 kB {5} [initial] [rendered]
chunk {1} styles.bundle.js, styles.bundle.js.map (styles) 926 kB {5} [initial] [rendered]
chunk {2} scripts.bundle.js, scripts.bundle.js.map (scripts) 11.4 MB {5} [initial] [rendered]
chunk {3} main.bundle.js, main.bundle.js.map (main) 4.2 kB {4} [initial] [rendered]
chunk {4} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.93 MB [initial] [rendered]
chunk {5} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
WARNING in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader!./~/syncfusion-javascript/Content/ej/web/material/ej.theme.min.cssautoprefixer: D:\Samples\Frontend\Syncfusion\ej-ng-app1\node_modules\syncfusion-javascript\Content\ej\web\material\ej.theme.min.css:10:330880: Gradient has outdated direction syntax. New syntax is like `to left` instead of `right`.
@ ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader!./~/syncfusion-javascript/Content/ej/web/material/ej.web.all.min.css 4:10-157
@ ./~/syncfusion-javascript/Content/ej/web/material/ej.web.all.min.css
@ multi ./src/styles.css ./~/syncfusion-javascript/Content/ej/web/material/ej.web.all.min.css
ERROR in Error encountered resolving symbol values statically. Calling function 'EJAngular2Module', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in D:/Samples/Frontend/Syncfusion/ej-ng-app1/src/app/app.module.ts, resolving symbol AppModule in D:/Samples/Frontend/Syncfusion/ej-ng-app1/src/app/app.module.tswebpack: Failed to compile.
Attachment: ejngapp1_1561dcc2.zip
|
ng serve --aot false
|
i followed all steps here and the following steps works:
start app with: ng serve --aot falseerror comes with the function call .....now change some code, angular-cli triggers a rebuild in webpack
website is server correctlybut now when i want to make a final build (ng build --aot false) it always return error ERROR in Error encountered resolving symbol values statically. Calling function 'EJAngular2Module', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol... and i can not get pass this because here does not come to rebuild when i chang something....
So how can i now build my project?
ng build --watch
with this i can make build, but not with aot.
ng build --prod --aot false
but it breaks with the exception "ERROR in Error encountered resolving symbol values statically. Calling function 'EJAngular2Module'..."
|
ng build --prod --aot false –watch
|
Hi all,not sure if this question is still active but I manage to successfully build and serve Angular CLI created project with syncfusion.What I did is that i have created one const object of type ModuleWithProviders in my app.module.ts:import { NgModule, ModuleWithProviders } from '@angular/core';import { EJAngular2Module } from 'ej-angular2';const EjModule: ModuleWithProviders = {ngModule: EJAngular2Module};Then I replaced EJAngular2Module.forRoot() line with my object:@NgModule({declarations: [AppComponent,SupplierDiscountComponent],imports: [BrowserModule,FormsModule,HttpModule,EjModule //EJAngular2Module.forRoot()],providers: [],bootstrap: [AppComponent]})export class AppModule { }And this allowed me to successfully build and serve my project with Angular CLI.This resolves the "Error encountered resolving symbol values statically. Calling function 'EJAngular2Module', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /my-ej-app/src/app/app.module.ts, resolving symbol AppModule in /my-ej-app/src/app/app.module.ts".All external scripts for syncfusion, jquery, ... are loaded through angular cli configuration file through styles and scripts configuration.Note: I'm using current Angular version 4.0.0 with Syncfusion and ej-angular2 version 15.1.41.
Thanks.
- 31 Replies
- 13 Participants
-
TH Thuc
- Nov 29, 2016 11:50 AM UTC
- Apr 27, 2017 05:29 AM UTC