brophdawg11 / ng-playground Goto Github PK
View Code? Open in Web Editor NEWAngular2 Playground App
Angular2 Playground App
You blog post was very enlightening. One issue I have is when the form starts out blank, as in used for an "Add New" form, as well as an "Edit" form.
When I comment out line 68 of your Plnkr:
//this.initialState = this.getParentData();
... the console throws an error complaining about a missing FormGroup, etc. How do I initialize the forms for a blank initial state?
Hi, nice Blogpost by the way, but how can you load Data into the nested forms e.g. with an http service?
I think its only working at the moment, because you load the data out of an array.
I followed the tutorial Nested Form on how to create a nested form for angular. I have forked their code and created a two level nested form.
Here are my goals:
The Problem:
I cannot get the grandchild (child of child -infant) inputbox to show up after I clicked Add Child
. The inputbox only shows up after I clicked, 'Add Infant'.
The input box appear there only during initialization.
Please checkout my Plunker: https://embed.plnkr.co/O1iwys/
I believe that I have to initialize it here: (When I add the child)
ngOnInit() {
console.log('Initializing kid list', this.kid);
this.childForm.addControl('kid', new FormArray([]));
}
When I Add Child
I do not see the input box for infants.
addChild() {
const child: ChildData = {
id: Math.floor(Math.random() * 100),
childField1: 'hello',
childField2: '',
childHiddenField1: '',
kid: []
};
this.children.push(child);
this.cd.detectChanges();
return false;
}
Please checkout my Plunker: https://embed.plnkr.co/O1iwys/
I'm getting 'change after check' errors when a required field of a child form is an empty string. You can see this in my fork (and PR), if you make this change:
childField1: [ data.childField1 || '', Validators.required ],
to
childField1: [ '', Validators.required ],
I'm having to work through this currently as my project is invested in this pattern.
Hi,
about your article here: https://brophy.org/post/nested-reactive-forms-in-angular2/
I tried to add multiple child component at the same time, then I have a infinite loop.
From what I can understand:
BUT at the same time we continue to add new childDATA in ParentListComponent, which result in an infinite loop.
How can we avoid this side effect?
By answering this question, you will help me to find a way to loadData from an HTTP url.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.