SlideShare ist ein Scribd-Unternehmen logo
1 von 3
Downloaden Sie, um offline zu lesen
How to Build Dynamic Forms 
in Angular Directive with a Backend 
In this blog we will demonstrate how to build dynamic forms 
in Angular with a backend, that in the end will return the 
configuration and data. This code was created for anyone 
who needs to build a complex project with many forms. To 
demonstrate the server side we will use Backand’s REST API in 
addition to referencing the full code in GitHub. 
Quickly on Backand 
Backand is a backend to an AngularJS front-end. With Backand you can connect 
to any database. Once connected you can select tables and easily configure 
the set of fields to be presented in each form (or grid), including types of 
fields, default values, whether a field is required, and additional constraints 
such as minimum and maximum values. 
Dynamic Forms 
A directive in Backand generates a form dynamically with a set of fields 
whose content is fetched when the screen is loaded. This causes the need 
to generate screens using ‘ng-repeat’ on the set of fields configured for the 
screen as fetched for the server. 
www.backand.com
Field Directives 
To facilitate modular dynamic form construction, we defined a set of directives 
for the possible field type. Each directive comes with validation error messages 
that are configurable. 
A directive has four parameters: 
1. Field – set of properties of the field, including: name, type, required, 
disabled, show/hide and optional: format, minimum value, maximum 
value, pattern 
2. Value – value of field, for an ‘input’ field will include the attribute ‘val’ 
3. Errors – structure of validation error strings 
4. InputClass – for field styling using ‘ng-class’ 
In the HTML we use the directive as: 
www.backand.com 
The ‘js’ for the ‘input’ directive is: 
With the partial for the HTML, where we use Bootstrap:
The case of pattern and no pattern are distinguished because ‘ng-pattern’ will 
not work with an empty pattern. 
In a controller using the directive, we assign the variables used as parameters 
of the directive: 
Because we use ‘ng-model’, we have two-way data binding. 
Dynamic Form Construction 
Once we fetch the form configuration to the variable ‘fields’ and the pre-filled 
data into ‘values’, we use ‘ng-repeat’ to generate the various fields: 
Other Directives 
Similar and more complicated directives are defined using the same approach 
for numeric input, email, links, datepicker, and more. For the full details see 
the GitHub repository. 
Build your Bootstrap + Angular app with Backand today. — Get started now. 
www.backand.com 
Contact Information 
Backand Inc. 
info@backand.com 
www.backand.com

Weitere ähnliche Inhalte

Was ist angesagt?

Comparison of-angular-8 vs react-js
Comparison of-angular-8 vs react-jsComparison of-angular-8 vs react-js
Comparison of-angular-8 vs react-jseasyjobworld
 
Angular vs. AngularJS: A Complete Comparison Guide
Angular vs. AngularJS: A Complete Comparison GuideAngular vs. AngularJS: A Complete Comparison Guide
Angular vs. AngularJS: A Complete Comparison GuideCloud Analogy
 
Angular js training in noida
Angular js training in noidaAngular js training in noida
Angular js training in noidanihalsingh113
 
Angularjs on line training
Angularjs on line trainingAngularjs on line training
Angularjs on line trainingJahan Murugassan
 
Angularjs overview
Angularjs  overviewAngularjs  overview
Angularjs overviewVickyCmd
 
OCTO BOF - How to build Netvibes with AngularJS
OCTO BOF - How to build Netvibes with AngularJSOCTO BOF - How to build Netvibes with AngularJS
OCTO BOF - How to build Netvibes with AngularJSJonathan Meiss
 
AngularJS Vs Angular: Understanding the Differences
AngularJS Vs Angular: Understanding the DifferencesAngularJS Vs Angular: Understanding the Differences
AngularJS Vs Angular: Understanding the DifferencesTechtic Solutions
 
Angular js up & running
Angular js up & runningAngular js up & running
Angular js up & runningJunaid Baloch
 
Angular 6 - The Complete Guide
Angular 6 - The Complete GuideAngular 6 - The Complete Guide
Angular 6 - The Complete GuideSam Dias
 
Best Angular Training Online: Angular tutorial | Learn Angular 2 to 10 |
Best Angular Training Online: Angular tutorial | Learn Angular 2 to 10 | Best Angular Training Online: Angular tutorial | Learn Angular 2 to 10 |
Best Angular Training Online: Angular tutorial | Learn Angular 2 to 10 | Shailendra Chauhan
 
Angular crash course
Angular crash courseAngular crash course
Angular crash courseBirhan Nega
 
IMPROVE YOUR WEBSITE PERFORMANCE WITH ANGULAR JS2
IMPROVE YOUR WEBSITE PERFORMANCE WITH ANGULAR JS2IMPROVE YOUR WEBSITE PERFORMANCE WITH ANGULAR JS2
IMPROVE YOUR WEBSITE PERFORMANCE WITH ANGULAR JS2Paul Cook
 
Angular JS training institute in Jaipur
           Angular JS training institute in Jaipur           Angular JS training institute in Jaipur
Angular JS training institute in JaipurHEMANT SAXENA
 

Was ist angesagt? (20)

Comparison of-angular-8 vs react-js
Comparison of-angular-8 vs react-jsComparison of-angular-8 vs react-js
Comparison of-angular-8 vs react-js
 
Ajs ppt
Ajs pptAjs ppt
Ajs ppt
 
Angular vs. AngularJS: A Complete Comparison Guide
Angular vs. AngularJS: A Complete Comparison GuideAngular vs. AngularJS: A Complete Comparison Guide
Angular vs. AngularJS: A Complete Comparison Guide
 
Angular js training in noida
Angular js training in noidaAngular js training in noida
Angular js training in noida
 
Angularjs on line training
Angularjs on line trainingAngularjs on line training
Angularjs on line training
 
React js vs angularjs
React js vs angularjsReact js vs angularjs
React js vs angularjs
 
Angularjs overview
Angularjs  overviewAngularjs  overview
Angularjs overview
 
OCTO BOF - How to build Netvibes with AngularJS
OCTO BOF - How to build Netvibes with AngularJSOCTO BOF - How to build Netvibes with AngularJS
OCTO BOF - How to build Netvibes with AngularJS
 
AngularJS Vs Angular: Understanding the Differences
AngularJS Vs Angular: Understanding the DifferencesAngularJS Vs Angular: Understanding the Differences
AngularJS Vs Angular: Understanding the Differences
 
Angular js up & running
Angular js up & runningAngular js up & running
Angular js up & running
 
Angular 6 - The Complete Guide
Angular 6 - The Complete GuideAngular 6 - The Complete Guide
Angular 6 - The Complete Guide
 
AngularJS Overview
AngularJS OverviewAngularJS Overview
AngularJS Overview
 
React vs Angular, who wins the competition?
React vs Angular, who wins the competition?React vs Angular, who wins the competition?
React vs Angular, who wins the competition?
 
Best Angular Training Online: Angular tutorial | Learn Angular 2 to 10 |
Best Angular Training Online: Angular tutorial | Learn Angular 2 to 10 | Best Angular Training Online: Angular tutorial | Learn Angular 2 to 10 |
Best Angular Training Online: Angular tutorial | Learn Angular 2 to 10 |
 
Angular crash course
Angular crash courseAngular crash course
Angular crash course
 
IMPROVE YOUR WEBSITE PERFORMANCE WITH ANGULAR JS2
IMPROVE YOUR WEBSITE PERFORMANCE WITH ANGULAR JS2IMPROVE YOUR WEBSITE PERFORMANCE WITH ANGULAR JS2
IMPROVE YOUR WEBSITE PERFORMANCE WITH ANGULAR JS2
 
technology@web
technology@webtechnology@web
technology@web
 
Graphql
GraphqlGraphql
Graphql
 
Itroducing Angular JS
Itroducing Angular JSItroducing Angular JS
Itroducing Angular JS
 
Angular JS training institute in Jaipur
           Angular JS training institute in Jaipur           Angular JS training institute in Jaipur
Angular JS training institute in Jaipur
 

Ähnlich wie How to Build Dynamic Forms in Angular Directive with a Backend

AngularJS Fundamentals + WebAPI
AngularJS Fundamentals + WebAPIAngularJS Fundamentals + WebAPI
AngularJS Fundamentals + WebAPIEric Wise
 
Angular Presentation
Angular PresentationAngular Presentation
Angular PresentationAdam Moore
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs WorkshopRan Wahle
 
Creating custom Validators on Reactive Forms using Angular 6
Creating custom Validators on Reactive Forms using Angular 6Creating custom Validators on Reactive Forms using Angular 6
Creating custom Validators on Reactive Forms using Angular 6AIMDek Technologies
 
JavaScriptIn this project you will create an interactive map for a.pdf
JavaScriptIn this project you will create an interactive map for a.pdfJavaScriptIn this project you will create an interactive map for a.pdf
JavaScriptIn this project you will create an interactive map for a.pdfsanjeevbansal1970
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfoliomwillmer
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseEPAM Systems
 
Build your website with angularjs and web apis
Build your website with angularjs and web apisBuild your website with angularjs and web apis
Build your website with angularjs and web apisChalermpon Areepong
 
MongoDB.pdf
MongoDB.pdfMongoDB.pdf
MongoDB.pdfArthyR3
 
Presentation on angular 5
Presentation on angular 5Presentation on angular 5
Presentation on angular 5Ramesh Adhikari
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014Ran Wahle
 
What’s new in Visual Studio 2010
What’s new in Visual Studio 2010What’s new in Visual Studio 2010
What’s new in Visual Studio 2010Sandun Perera
 
Angular Interview Questions-PDF.pdf
Angular Interview Questions-PDF.pdfAngular Interview Questions-PDF.pdf
Angular Interview Questions-PDF.pdfJohnLeo57
 
Top 10 Techniques For React Performance Optimization in 2022.pptx
Top 10 Techniques For React Performance Optimization in 2022.pptxTop 10 Techniques For React Performance Optimization in 2022.pptx
Top 10 Techniques For React Performance Optimization in 2022.pptxBOSC Tech Labs
 
Angularjs2 presentation
Angularjs2 presentationAngularjs2 presentation
Angularjs2 presentationdharisk
 
Murach: How to validate data in asp.net core mvc
Murach: How to validate data in asp.net core mvcMurach: How to validate data in asp.net core mvc
Murach: How to validate data in asp.net core mvcMahmoudOHassouna
 

Ähnlich wie How to Build Dynamic Forms in Angular Directive with a Backend (20)

AngularJS Fundamentals + WebAPI
AngularJS Fundamentals + WebAPIAngularJS Fundamentals + WebAPI
AngularJS Fundamentals + WebAPI
 
Angular.pptx
Angular.pptxAngular.pptx
Angular.pptx
 
Unit 2 - Data Binding.pptx
Unit 2 - Data Binding.pptxUnit 2 - Data Binding.pptx
Unit 2 - Data Binding.pptx
 
Angular Presentation
Angular PresentationAngular Presentation
Angular Presentation
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
 
Creating custom Validators on Reactive Forms using Angular 6
Creating custom Validators on Reactive Forms using Angular 6Creating custom Validators on Reactive Forms using Angular 6
Creating custom Validators on Reactive Forms using Angular 6
 
JavaScriptIn this project you will create an interactive map for a.pdf
JavaScriptIn this project you will create an interactive map for a.pdfJavaScriptIn this project you will create an interactive map for a.pdf
JavaScriptIn this project you will create an interactive map for a.pdf
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete CourseAngular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Build your website with angularjs and web apis
Build your website with angularjs and web apisBuild your website with angularjs and web apis
Build your website with angularjs and web apis
 
Django wrapper
Django wrapperDjango wrapper
Django wrapper
 
MongoDB.pdf
MongoDB.pdfMongoDB.pdf
MongoDB.pdf
 
Presentation on angular 5
Presentation on angular 5Presentation on angular 5
Presentation on angular 5
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
 
What’s new in Visual Studio 2010
What’s new in Visual Studio 2010What’s new in Visual Studio 2010
What’s new in Visual Studio 2010
 
Angular Interview Questions-PDF.pdf
Angular Interview Questions-PDF.pdfAngular Interview Questions-PDF.pdf
Angular Interview Questions-PDF.pdf
 
Top 10 Techniques For React Performance Optimization in 2022.pptx
Top 10 Techniques For React Performance Optimization in 2022.pptxTop 10 Techniques For React Performance Optimization in 2022.pptx
Top 10 Techniques For React Performance Optimization in 2022.pptx
 
Angularjs2 presentation
Angularjs2 presentationAngularjs2 presentation
Angularjs2 presentation
 
Murach: How to validate data in asp.net core mvc
Murach: How to validate data in asp.net core mvcMurach: How to validate data in asp.net core mvc
Murach: How to validate data in asp.net core mvc
 

Mehr von Backand Cohen

Start an Angular project fast, then go faster using AWS and Back&
Start an Angular project fast, then go faster using AWS and Back&Start an Angular project fast, then go faster using AWS and Back&
Start an Angular project fast, then go faster using AWS and Back&Backand Cohen
 
Five Common Angular Mistakes
Five Common Angular MistakesFive Common Angular Mistakes
Five Common Angular MistakesBackand Cohen
 
ng-grid and a Simple REST API
ng-grid and a Simple REST APIng-grid and a Simple REST API
ng-grid and a Simple REST APIBackand Cohen
 
REST Easy with AngularJS - ng-grid CRUD Example
REST Easy with AngularJS - ng-grid CRUD ExampleREST Easy with AngularJS - ng-grid CRUD Example
REST Easy with AngularJS - ng-grid CRUD ExampleBackand Cohen
 
Testing Two-Way Data Binding in AngularJS
Testing Two-Way Data Binding in AngularJSTesting Two-Way Data Binding in AngularJS
Testing Two-Way Data Binding in AngularJSBackand Cohen
 
Backand Presentation
Backand PresentationBackand Presentation
Backand PresentationBackand Cohen
 
AngularJS with Slim PHP Micro Framework
AngularJS with Slim PHP Micro FrameworkAngularJS with Slim PHP Micro Framework
AngularJS with Slim PHP Micro FrameworkBackand Cohen
 
How-to Increase User Engagement by 25% with User Segmented Push Notifications
How-to Increase User Engagement by 25% with User Segmented Push NotificationsHow-to Increase User Engagement by 25% with User Segmented Push Notifications
How-to Increase User Engagement by 25% with User Segmented Push NotificationsBackand Cohen
 
The Enterprise Excel Hell
The Enterprise Excel HellThe Enterprise Excel Hell
The Enterprise Excel HellBackand Cohen
 

Mehr von Backand Cohen (9)

Start an Angular project fast, then go faster using AWS and Back&
Start an Angular project fast, then go faster using AWS and Back&Start an Angular project fast, then go faster using AWS and Back&
Start an Angular project fast, then go faster using AWS and Back&
 
Five Common Angular Mistakes
Five Common Angular MistakesFive Common Angular Mistakes
Five Common Angular Mistakes
 
ng-grid and a Simple REST API
ng-grid and a Simple REST APIng-grid and a Simple REST API
ng-grid and a Simple REST API
 
REST Easy with AngularJS - ng-grid CRUD Example
REST Easy with AngularJS - ng-grid CRUD ExampleREST Easy with AngularJS - ng-grid CRUD Example
REST Easy with AngularJS - ng-grid CRUD Example
 
Testing Two-Way Data Binding in AngularJS
Testing Two-Way Data Binding in AngularJSTesting Two-Way Data Binding in AngularJS
Testing Two-Way Data Binding in AngularJS
 
Backand Presentation
Backand PresentationBackand Presentation
Backand Presentation
 
AngularJS with Slim PHP Micro Framework
AngularJS with Slim PHP Micro FrameworkAngularJS with Slim PHP Micro Framework
AngularJS with Slim PHP Micro Framework
 
How-to Increase User Engagement by 25% with User Segmented Push Notifications
How-to Increase User Engagement by 25% with User Segmented Push NotificationsHow-to Increase User Engagement by 25% with User Segmented Push Notifications
How-to Increase User Engagement by 25% with User Segmented Push Notifications
 
The Enterprise Excel Hell
The Enterprise Excel HellThe Enterprise Excel Hell
The Enterprise Excel Hell
 

Kürzlich hochgeladen

Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 

Kürzlich hochgeladen (20)

Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

How to Build Dynamic Forms in Angular Directive with a Backend

  • 1. How to Build Dynamic Forms in Angular Directive with a Backend In this blog we will demonstrate how to build dynamic forms in Angular with a backend, that in the end will return the configuration and data. This code was created for anyone who needs to build a complex project with many forms. To demonstrate the server side we will use Backand’s REST API in addition to referencing the full code in GitHub. Quickly on Backand Backand is a backend to an AngularJS front-end. With Backand you can connect to any database. Once connected you can select tables and easily configure the set of fields to be presented in each form (or grid), including types of fields, default values, whether a field is required, and additional constraints such as minimum and maximum values. Dynamic Forms A directive in Backand generates a form dynamically with a set of fields whose content is fetched when the screen is loaded. This causes the need to generate screens using ‘ng-repeat’ on the set of fields configured for the screen as fetched for the server. www.backand.com
  • 2. Field Directives To facilitate modular dynamic form construction, we defined a set of directives for the possible field type. Each directive comes with validation error messages that are configurable. A directive has four parameters: 1. Field – set of properties of the field, including: name, type, required, disabled, show/hide and optional: format, minimum value, maximum value, pattern 2. Value – value of field, for an ‘input’ field will include the attribute ‘val’ 3. Errors – structure of validation error strings 4. InputClass – for field styling using ‘ng-class’ In the HTML we use the directive as: www.backand.com The ‘js’ for the ‘input’ directive is: With the partial for the HTML, where we use Bootstrap:
  • 3. The case of pattern and no pattern are distinguished because ‘ng-pattern’ will not work with an empty pattern. In a controller using the directive, we assign the variables used as parameters of the directive: Because we use ‘ng-model’, we have two-way data binding. Dynamic Form Construction Once we fetch the form configuration to the variable ‘fields’ and the pre-filled data into ‘values’, we use ‘ng-repeat’ to generate the various fields: Other Directives Similar and more complicated directives are defined using the same approach for numeric input, email, links, datepicker, and more. For the full details see the GitHub repository. Build your Bootstrap + Angular app with Backand today. — Get started now. www.backand.com Contact Information Backand Inc. info@backand.com www.backand.com