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
This repo houses some additional features which provd to be very useful in projects.
218
+
219
+
## String polyfill
220
+
The file `utils/polyfills.utils.ts` contains a string polyfills.
221
+
With this polyfill you can do this:
222
+
```
223
+
'Teststring'.isEmpty() => false
224
+
''.isEmpty() => true
225
+
undefined.isEmpty() => true
226
+
```
227
+
228
+
## Validation
229
+
The file `utils/validation.utils.ts` contains some validatoin helper functions and regex patterns.
230
+
231
+
The function `validateFilledFieldsWithValidationRules` us really useful as you can check a object which is already prefiled if it's valid and if not show errors.
232
+
233
+
The function `controllerValidByRules` will check if a validation controller is valid.
234
+
235
+
## Route generator service
236
+
If you have router tree like this
237
+
```
238
+
root
239
+
/ \
240
+
left right
241
+
```
242
+
You can't navigate from `left` to `right` with `this.router.navigateToRoute(...)` as `right` is in a branch which `left` is unaware of. This is due to the injection of the router service.
243
+
244
+
One solution is to use `this.router.navigate(...)` but this is unsave as if the route configuration is changed the navigation is broken as it's hardcoded.
245
+
246
+
The `route-generator.service.ts` will provide a type safe solution for save navigation.
247
+
248
+
Check the following files to get an idea how to use it:
249
+
-`route-generator.service.ts`
250
+
-`app.vm.ts` and `app.routes.ts`
251
+
-`child-router.vm.ts` and `child-router.routes.ts`
252
+
253
+
As an example you could navigate like this from `left` to `right`
254
+
```
255
+
this.routeGeneratorService.navigateByRouteNames(
256
+
{ routeName: 'root' },
257
+
{ routeName: 'right' }
258
+
);
259
+
```
260
+
261
+
You can also pass route parameters like this but remember that query parameter have to attached to the last element
0 commit comments