Giter Site home page Giter Site logo

ng-playground's People

Contributors

angular-cli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ng-playground's Issues

Excellent post...

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?

Angular 2 - Double level nested form - not initializing child of child

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:

  1. Parent form (div with inputboxes)
  2. Ability to Add multiple Child to Parent (div with inputboxes)
  3. Ability to Add multiple Grandchild to the Child created above (div with inputboxes)

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;
        }

no-input-unless-clicked

Please checkout my Plunker: https://embed.plnkr.co/O1iwys/

Added muliple child at the same time doesnt work

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:

  • new childDATA is added in ParentListComponent
  • the for loop in th ParentListComponent.html, display new childComponent
  • each new childComponent add new childItemForm
  • then the observable of form.onValueChange receive new value
  • the new value is merged with the DATA.

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.