vendredi 19 février 2016

Struts2 `

I have observed a very peculiar behaviour of <s:checkbox> rendering along with Bootstrap 3 and AngularJS.

I have these two <s:checkbox> in my page, wrapped by some elements of Bootstrap 3 styles:

<div class="col-md-1">
    <div class="form-group">
        <div class="form-other">
            <label for="activaCheck"><s:text name="actividad.busqueda.activa"/></label>
                <s:checkbox class="form-control" id="activaCheck" name="activaCheck" ng-model="formData.activaCheck" value="true"></s:checkbox>
                <s:checkbox class="form-control" id="activaCheck2" name="activaCheck2"  value="true"></s:checkbox>
        </div>
    </div>
</div>

As you can see, the only difference between them, is that the first has attribute ng-model = "xxx", while the second doesn't.

And, in my page, they are rendered differently, although they both are supposed to be pre-selected, because I set value="true". And when we inspect in FF, we can see the first <s:checkbox> has checked="checked", but is not rendered. I have tested in Chrome and FF, same.

The first checkbox is "checked", but not rendered.

So I am thinking about AngularJS is taking over part of rendering job which Struts 2 is responsible of, at least in this case. I want some explanation from developers of AngularJS, or this is the expected result?




Aucun commentaire:

Enregistrer un commentaire