|
| 1 | +# Ej2AngularSamples |
| 2 | + |
| 3 | +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.2.1. |
| 4 | + |
| 5 | +## Run your Sample Browser |
| 6 | + |
| 7 | + |
| 8 | +### Development server |
| 9 | + |
| 10 | +Run `npm run ship-source` for to update latest styles and stackb sample source. |
| 11 | + |
| 12 | +Then run `npm run start` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. |
| 13 | + |
| 14 | +### Production server |
| 15 | + |
| 16 | +Run `npm run ship-source` for to update latest styles and stackb sample source. |
| 17 | + |
| 18 | +Then run `npm run start:prod` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. |
| 19 | + |
| 20 | +### Build |
| 21 | + |
| 22 | +Run `npm run build:dev` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `npm run build:prod` flag for a production build. |
| 23 | + |
| 24 | +# Angular Sample Configuration |
| 25 | + |
| 26 | +## Adding your sample |
| 27 | +Create your new folder in 'src' location and name the folder as control name for example “listview” it is control name. |
| 28 | + |
| 29 | +_Note: Do not use whitespace at any cause in folder’s name. Use “-” instead of space._ |
| 30 | + |
| 31 | +## Add module for your sample |
| 32 | +Add your sample router module named controlName.module.ts |
| 33 | + |
| 34 | +_Note: Export sample routed array of links. This has used to sample list._ |
| 35 | + |
| 36 | +## Add Routing for your sample |
| 37 | +Add your sample router module to sb router module |
| 38 | +1. Import your **controlName.moduler.ts** in **sb.router.ts** |
| 39 | +2. Add imported module to app routes |
| 40 | + |
| 41 | +``` |
| 42 | +import { ListViewModule } from '../listview/listview.module'; |
| 43 | +
|
| 44 | +const appRoutes: any = [ |
| 45 | + { path: 'listview', loadChildren: ListViewModule }, |
| 46 | + { path: '', redirectTo: 'listview/default', pathMatch: 'full' , hideOnDevice:true}, |
| 47 | +]; |
| 48 | +``` |
| 49 | +*Note: set **hideOnDevice** as true if you want to hide a sample in devices.* |
| 50 | +## Adding your control dependency |
| 51 | + |
| 52 | +Add your dependency in “package.json” file inside the dependencies. |
| 53 | + |
| 54 | +Note: Here, '\*' Specifies that install the latest published package form the online. '\*' is recommended for Syncfusion packages. |
| 55 | + |
| 56 | +``` |
| 57 | +"dependencies": { |
| 58 | + "@syncfusion/ej2-angular-base": "*", |
| 59 | + "@syncfusion/ej2-angular-list": "*", |
| 60 | +}, |
| 61 | +``` |
| 62 | + |
| 63 | +Add your dependency in “system.config.js” file inside the packages. |
| 64 | + |
| 65 | +``` |
| 66 | +
|
| 67 | +packages: { |
| 68 | + 'app': { main: 'main.js', defaultExtension: 'js' }, |
| 69 | + 'rxjs': { defaultExtension: 'js' }, |
| 70 | +
|
| 71 | + '@syncfusion/ej2-lists': { main: '/src/list-view/index.js', defaultExtension: 'js' }, |
| 72 | + '@syncfusion/ej2-data': { main: '/index.js', defaultExtension: 'js' }, |
| 73 | + '@syncfusion/ej2-base': { main: '/index.js', defaultExtension: 'js' }, |
| 74 | + '@syncfusion/ej2-angular-base': { main: '//index.js', defaultExtension: 'js' }, |
| 75 | + '@syncfusion/ej2-angular-list': { main: 'src/list-view/index.js', defaultExtension: 'js' } |
| 76 | + |
| 77 | +}, |
| 78 | +
|
| 79 | +``` |
| 80 | +## Adding style dependency |
| 81 | + |
| 82 | +Add your dependency in “config.json” file inside the styleDependency array. |
| 83 | + |
| 84 | +``` |
| 85 | +{ |
| 86 | + "styleDependency":["ej2-angular-lists"] |
| 87 | +} |
| 88 | +``` |
| 89 | +## Add description in sample |
| 90 | + |
| 91 | +Add sample description within the div tag with id as **description**. |
| 92 | + |
| 93 | +```html |
| 94 | +<div class="control-section"> |
| 95 | +<div id='description'> |
| 96 | +//sample description. |
| 97 | +</div> |
| 98 | +</div> |
| 99 | +``` |
| 100 | +## Configure Sample List |
| 101 | + |
| 102 | +Add your samples in “samplelist.ts” located in “/src/common” folder |
| 103 | +1. Import your Sample Module routed array for json |
| 104 | +2. Add your samples in Sample List as Like below |
| 105 | + |
| 106 | +``` |
| 107 | +import { listAppRoutes } from '../listview/listview.module'; |
| 108 | +
|
| 109 | +export let samplesList: any = [ |
| 110 | + { |
| 111 | + "name": "ListView", "category": "List", "path": "listview", "samples": listAppRoutes, |
| 112 | + } |
| 113 | +]; |
| 114 | +``` |
| 115 | + |
| 116 | +## FAQ |
| 117 | + |
| 118 | +### 1) Is it possible to refer css files in sample html file? |
| 119 | + |
| 120 | + No, In your sample level html files, you don't read css files. |
| 121 | + |
| 122 | + For example: [Refer Here](https://gitlab.syncfusion.com/essential-studio/ej2-diagram-angular-samples/blob/master/src/app/diagram/bpmn-editor.html#L1). |
| 123 | + |
| 124 | +### 2) How to solve below Error while compilation? |
| 125 | + |
| 126 | +#### Error: |
| 127 | + |
| 128 | + > ngc -p ./Samples/tsconfig.json |
| 129 | +
|
| 130 | + > : Can't bind to 'dataSource' since it isn't a known property of 'ejs-dropdownlist'. |
| 131 | + 1. If 'ejs-dropdownlist' is an Angular component and it has 'dataSource' input, then verify that it is part of this module. |
| 132 | + 2. If 'ejs-dropdownlist' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. |
| 133 | + 3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" <div style="max-width: 200px" |
| 134 | + |
| 135 | +#### Solution |
| 136 | + |
| 137 | +If you have used some control in your samples, you have to map component module in your control module. |
| 138 | + |
| 139 | +For Example: If You use `ejs-dropdownlist` control in your [sample](https://gitlab.syncfusion.com/essential-studio/ej2-diagram-angular-samples/blob/release/17.1.0.1/src/app/diagram/ports.html#L133), you need to import that control module in your sample level [modulefile](https://gitlab.syncfusion.com/essential-studio/ej2-diagram-angular-samples/blob/release/17.1.0.1/src/app/diagram/diagram.module.ts#L14) |
0 commit comments