From 5a97932fb3d97bde5035ae823c511e036991c785 Mon Sep 17 00:00:00 2001 From: dmitrykurmanov Date: Wed, 10 Jul 2024 10:18:21 +0000 Subject: [PATCH] updated survey-library docs [azurepipelines skip] --- docs/get-started-angular.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/get-started-angular.md b/docs/get-started-angular.md index 0ef3cee48f..5edfa5c434 100644 --- a/docs/get-started-angular.md +++ b/docs/get-started-angular.md @@ -52,6 +52,7 @@ SurveyJS Form Library is shipped with several predefined themes illustrated belo To add SurveyJS themes to your Angular application, open the `angular.json` file and reference the Form Library style sheet: ```js +// angular.json { "$schema": "./node_modules/@angular/cli/lib/config/schema.json", // ... @@ -77,6 +78,13 @@ To add SurveyJS themes to your Angular application, open the `angular.json` file } ``` +When [using standalone components](https://github.com/surveyjs/code-examples/tree/main/get-started-library/angular-standalone-components), import the style sheet directly in the component file: + +```js +// survey.component.ts +import "survey-core/defaultV2.css"; +``` + This style sheet applies the Default theme. If you want to apply a different predefined theme or create a custom theme, refer to the following help topic for detailed instructions: [Themes & Styles](https://surveyjs.io/form-library/documentation/manage-default-themes-and-styles). > Previous to v1.9.100, SurveyJS also supplied the Modern theme, which is now obsolete. Please migrate to one of the predefined themes or create a custom theme. @@ -158,7 +166,7 @@ export class AppComponent implements OnInit { ## Render the Form -Before you render the survey, you need to import the module that integrates the SurveyJS Form Library with Angular. Open your NgModule class (usually resides in the `app.module.ts` file), import the `SurveyModule` from `survey-angular-ui`, and list it in the `imports` array. +Before you render the survey, you need to import the module that integrates the SurveyJS Form Library with Angular. Open your `NgModule` class (usually resides in the `app.module.ts` file), import the `SurveyModule` from `survey-angular-ui`, and list it in the `imports` array. ```js // app.module.ts @@ -175,7 +183,24 @@ import { SurveyModule } from "survey-angular-ui"; bootstrap: [ ... ] }) export class AppModule { } +``` + +When [using standalone components](https://github.com/surveyjs/code-examples/tree/main/get-started-library/angular-standalone-components), import the `SurveyModule` and add it to the `imports` array directly in the component file: +```js +// survey.component.ts +// ... +import { SurveyModule } from 'survey-angular-ui'; + +@Component({ + // ... + standalone: true, + imports: [ SurveyModule ], + // ... +}) +export class SurveyComponent implements OnInit { + // ... +} ``` To render a survey, add a `` element to your component template and bind the element's `model` attribute to the model instance you created in the previous step: