Rendelo-Common is an Angular library used for implementing functions, pipes, services etc., which are used in all of the angular projects made by Aranyklinika.
1. Installation
2. How to use
-2.1 Pipes
-2.2 Validators
-2.3 Services
3. External libraries
- Run the
npm install rendelo-common
command to install the package. - Run
npm install moment
command to install moment.js. (Necessary for the library!)
- Import
RendeloPipesModule
fromrendelo-common
in yourapp.module.ts
file and also add it to theimports
array! - You can now use all pipes everywhere in your project. example: {{variableName | pipeName}}
-
fileSize
: Transforms a number to a file size unit based on its value. (from 0-3 » B to GB) -
firstUpperCase
: Transforms given string to start with an uppercase letter. -
newTabLink
: Extends anchor tag with arguments to open in a new tab. -
operator
: Returns modified string based on its original value, or stays the same if its unique. -
plural
: Transform given value into plural form. -
safeHtml
: Bypass security and trust the given value to be safe HTML. -
safeScript
: Bypass security and trust the given value to be safe JavaScript. -
safeStyle
: Bypass security and trust the given value to be safe style value (CSS). -
safeUrl
: Bypass security and trust the given value to be a safe style URL. -
status
: Return message based on its status model value.
- Import
validator-name
fromrendelo-common
in thecomponent-name.component.ts
file, where you want to use it. - Add the validator in your
Reactive form
validators array.
-
ValidateDate
: Check if the given input is a valid date or not. -
ValidateTaj
: Check if the given input contains a valid TAJ number. -
ValidateForbidden
: Check if the given input contains the forbidden values from the forbiddenValues array.
- Import
service-name
fromrendelo-common
in yourcomponent-name.component.ts
file. - Create an instance of the service in the components constructor
- You can use the service in your component!
-
CommonService
: Collection of useful functions, which may be used in more parts of the application. -
TimerService
: Implements a timer, which can be fully customized.
This library was generated with Angular CLI