You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/integration_with_angular.md
+98-55Lines changed: 98 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,93 +24,87 @@ Create a new **my-angular-event-calendar-app** project using Angular CLI. Run th
24
24
ng new my-angular-event-calendar-app
25
25
~~~
26
26
27
-
The command above installs all the necessary tools and dependencies, so you don't need to run any additional commands.
27
+
The command above installs all the necessary tools, so you don't need to run any additional commands.
28
28
29
29
### Installation of dependencies
30
30
31
-
Go to the app directory:
31
+
Go to the new created app directory:
32
32
33
33
~~~json
34
34
cd my-angular-event-calendar-app
35
35
~~~
36
36
37
-
Run the app with the following commands:
37
+
Install dependencies and start the dev server. For this, use the [**yarn**](https://yarnpkg.com/) package manager:
38
38
39
39
~~~json
40
-
yarn install
40
+
yarn
41
41
yarn start
42
42
~~~
43
43
44
44
The app should run on a localhost (for instance `http://localhost:3000`).
45
45
46
46
## Creating Event Calendar
47
47
48
-
Now you should get the DHTMLX Event Calendar code. First of all, stop the app and proceed with installing the Event Calendar package.
48
+
Now you should get the DHTMLX Event Calendar source code. First of all, stop the app and proceed with installing the Event Calendar package.
49
49
50
50
### Step 1. Package installation
51
51
52
52
Download the [**trial Event Calendar package**](/how_to_start/#installing-event-calendar-via-npm-and-yarn) and follow steps mentioned in the README file. Note that trial Event Calendar is available 30 days only.
53
53
54
54
### Step 2. Component creation
55
55
56
-
Now you need to create a component, to add an Event Calendar into the application. Create the **event-calendar** folder in the **src/app/** directory, add a new file into it and name it **event-calendar.component.ts**. Then complete the steps described below.
56
+
Now you need to create an Angular component, to add Event Calendar into the application. Create the **event-calendar** folder in the **src/app/** directory, add a new file into it and name it **event-calendar.component.ts**. Then complete the steps described below.
57
57
58
-
#### Importing source files
58
+
#### Import source files
59
59
60
60
Open the file and import Event Calendar source files. Note that:
61
61
62
-
- if you use PRO version and install the Event Calendar package from a local folder, the imported paths look like this:
62
+
- if you use PRO version and install the Event Calendar package from a local folder, the imported path looks like this:
In this tutorial you can see how to configure the **trial** version of Event Calendar.
75
75
76
-
#### Setting the container and adding Event Calendar
76
+
#### Set the container and initialize Event Calendar
77
77
78
-
To display Event Calendar on the page, you need to set the container to render the component inside. Use the code below:
78
+
To display Event Calendar on the page, you need to set the container to render the component inside and initialize Event Calendar using the corresponding constructor:
In the above code you also specified the `ngOnDestroy()` method that contains the `_calendar.destructor()` expression to clear the component when it is no longer needed.
113
-
114
108
#### Loading data
115
109
116
110
To add data into Event Calendar, you need to provide a data set. You can create the **data.ts** file in the **src/app/event-calendar/** directory and add some data into it:
@@ -148,69 +142,118 @@ export function getData() {
148
142
149
143
Then open the ***event-calendar.component.ts*** file. Import the file with data and specify the corresponding data properties to the configuration object of Event Calendar within the `ngOnInit()` method, as shown below.
You can also use the [`parse()`](/api/methods/js_eventcalendar_parse_method/) method inside the `ngOnInit()` method of Angular to load data into Event Calendar. It will reload data on each applied change.
176
+
You can also use the [`parse()`](/api/methods/js_eventcalendar_parse_method/) method inside the `ngOnInit()` method of Angular to load data into Event Calendar.
Now the Event Calendar component is ready. When the element will be added to the page, it will initialize the Event Calendar object with data. You can provide necessary configuration settings as well. Visit our [Event Calendar API docs](/api/overview/properties_overview/) to check the full list of available properties.
211
+
The `parse(data)` method provides data reloading on each applied change.
212
+
213
+
Now the Event Calendar component is ready to use. When the element will be added to the page, it will initialize the Event Calendar with data. You can provide necessary configuration settings as well. Visit our [Event Calendar API docs](/api/overview/properties_overview/) to check the full list of available properties.
178
214
179
215
#### Handling events
180
216
181
217
When a user makes some action in the Event Calendar, it invokes an event. You can use these events to detect the action and run the desired code for it. See the [full list of events](/api/overview/events_overview/).
182
218
183
219
Open the **event-calendar.component.ts** file and complete the `ngOnInit()` method as in:
Now it's time to add the component into your app. Open ***src/app/app.component.ts*** and use *EventCalendarComponent* instead of the default content by inserting the code below:
240
+
To add the ***EventCalendarComponent***component into the app, open the ***src/app/app.component.ts***file and replace the default code with the following one:
198
241
199
-
~~~jsx title="app.component.ts"
242
+
~~~jsx{5} title="app.component.ts"
200
243
import { Component } from"@angular/core";
201
244
202
245
@Component({
203
246
selector:"app-root",
204
-
template:`<event-calendar/>`
247
+
template:`<event-calendar/>`// a template created in the "event-calendar.component.ts" file
205
248
})
206
249
exportclassAppComponent {
207
250
name ="";
208
251
}
209
252
~~~
210
253
211
-
Then create the ***app.module.ts*** file in the ***src/app/*** directory and insert the *EventCalendarComponent* as provided below:
254
+
Then create the ***app.module.ts*** file in the ***src/app/*** directory and specify the *EventCalendarComponent* as shown below:
0 commit comments