(FRONT) FRONT (2024)

NativeScript and Angular form

For my opinion, this is most important and most difficult part of whole programming, because there are many scheme variants of realization this future and, of course, many restrictions and futures. Firstly native Android has no <Form tag, because this is not HTML application, secondary - Angular form (and supported module) this is not the same as NariveScript form (and supported module). And third part of difficulties is various validators.

So, first simplest scheme:

1. Simplest template based Angular form with NativeScriptFormsModule, FormsModule, ReactiveFormsModule.



This scheme mostly based on NativeScriptFormsModule.

On screen below you can see all you need to this scheme.

That's it with minimal scheme.

2. Add NgForm feature.

I have uncommented line 20 and 33 and this allow me replace speculative dummy tag <Form as StackLayout. This allow me include to scheme NgForm Angular future.



This get me additional feature. Reading value by NgForm Angular. I can receive value not as formGr.get('xxxxx').value but as ngFormRef.form.value



3. Add Validators.

This is the place to add validators



This is standard validator from my another project.



4. Add [(NgModel)] restriction.

Firstly [(NgModel)]='xxxx' is shortcut to [NgModel]='xxxx' plus (ngModelChange)='xxxx = $event' - this allow you turn on all restriction Typescript, but of course you need to prepare correct Model with full TypeScript type restriction.

For example transform this vanilla JS logic plus comments to strong TypeScript definition.



Look for example possible Typescript restriction.

Alternative way to Typescript is yup package.





Sorry, I have no time, will continue soon...



Comments ( )
<00>  <01>  <02>  <03>  <04>  <05>  <06>  <07>  <08>  <09>  <10>  <11>  <12>  <13>  <14>  <15>  <16>  <17>  <18>  <19>  <20>  <21>  <22>  <23
Link to this page: http://www.vb-net.com/NativeScriptAngularForm/Index.htm
<SITEMAP>  <MVC>  <ASP>  <NET>  <DATA>  <KIOSK>  <FLEX>  <SQL>  <NOTES>  <LINUX>  <MONO>  <FREEWARE>  <DOCS>  <ENG>  <CHAT ME>  <ABOUT ME>  < THANKS ME>