2

I am using the a Carousel for its effect of sliding, but I want to insert a form per slide, After inserting the ngForm, the $scope does not have the instance of that ngForm. If I place the ngForm outside of the Carousel, then the instance appear in the $scope. Example:

<data:carousel>
    <data:slide active="slides[0].active">
        <form name="formGI" data-ng-submit="SaveAndNext(cosvr.company)" novalidate>
            <div class="row-fluid text-center topSmallPad">
                <div class="span12">
                </div>
            </div>
        </form>
    </data:slide>
</data:carousel>

the code above is not working, the $scope should have an instance: $scope.formGI. but, If place the form outside the Carousel like this:

<form name="formGI" data-ng-submit="SaveAndNext(cosvr.company)" novalidate>
    <data:carousel>
        <data:slide active="slides[0].active">
            <div class="row-fluid text-center topSmallPad">
                <div class="span12">
                </div>
            </div>
        </data:slide>
    </data:carousel>
</form>

Works correctly... any ideas?

Checkout the Plunker: http://plnkr.co/edit/XR03h5akcu3IWXJwu7KW

and is happening in Accordions too!

4

1 回答 1

2

如果有人感兴趣,我做了一个 Carousel/Slide 的自制克隆/修改,称为 FormCarousel/FormSlide。

这是带有代码的 plunker 和一个工作示例:

http://plnkr.co/edit/JReSqUJQrTx3zQKROtww

检查浏览器的控制台以查看对象。

随意修改它,如果你愿意,让它更友好......但是,请分享它。

结构必须是:

<form-carousel>
    <form-slide active="forms[0].active" form_object="forms[0].form" form_name="frmMain">
        <form name="frmMain"></form>
    </form-slide>
</form-carousel>

所以对我来说工作得很好......希望可以帮助别人。

_e

于 2013-08-21T18:48:18.460 回答