angular-ui / bootstrap

PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
http://angular-ui.github.io/bootstrap/
MIT License
14.29k stars 6.73k forks source link

[ngbAccordion] Data loss on panel change #6474

Closed vinothinivenkatesan closed 7 years ago

vinothinivenkatesan commented 7 years ago

The issues forum is NOT for support requests. It is for bugs and feature requests only. Please read https://github.com/angular-ui/bootstrap/blob/master/CONTRIBUTING.md and search existing issues (both open and closed) prior to opening any new issue and ensure you follow the instructions therein.

Bug description: I have form in each accordion panel. Entered form data gets erased while switching between the panels.

Link to minimally-working plunker that reproduces the issue:

<ngb-accordion #acc="ngbAccordion" activeIds="ngb-panel-0">
  <ngb-panel title="first">
    <template ngbPanelContent>
<`form`>
      <div class="col-md-6">
            <div class="form-group row">
                <label for="inputEmail3" class="col-md-4 form-control-label">First Name</label>
                <div class="col-md-8">
                    <input class="form-control" name="firstname" placeholder="Enter Here" type="text">
                </div>
            </div>
        </div>
</form>
</template>
 </ngb-panel>
<ngb-panel title="second">
    <template ngbPanelContent>
<form>
      <div class="col-md-6">
            <div class="form-group row">
                <label for="inputEmail3" class="col-md-4 form-control-label">Second Name</label>
                <div class="col-md-8">
                    <input class="form-control" name="secondname" placeholder="Enter Here" type="text">
                </div>
            </div>
        </div>
</form>
</template>
 </ngb-panel>
</ngb-accordion>

Steps to reproduce the issue:

  1. Implement accordion component from ng-bootstrap.
  2. add a form with input field in each panel.
  3. enter value in input field in first panel and open second panel again open first panel.
  4. you can find the entered data missing in the input field

Version of Angular, UIBS, and Bootstrap

Angular: 2.4

UIBS:

Bootstrap: 4.0.0

WVWillHall commented 7 years ago

https://github.com/ng-bootstrap/ng-bootstrap

gbevan commented 7 years ago

+1

wesleycho commented 7 years ago

Closing as opened in the wrong repository as @WVWillHall pointed out.

One thing that might help though is that you should be using ngModel on the inputs - this is most likely a usage issue.