Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModelBinder #82

Open
cooolbasha opened this issue Sep 1, 2013 · 2 comments
Open

ModelBinder #82

cooolbasha opened this issue Sep 1, 2013 · 2 comments

Comments

@cooolbasha
Copy link

ModelBinder doesn't seem to work together with nested model( backbone-nested project) ..the changes from model don't get propogated to the nested elements.On changing the input value the span value doesn't change...If I replace the NestedModel with DeepModel it works..funny


<script type='text/coffeescript'>
        $ ->
            class MyModel extends Backbone.NestedModel
                defaults:
                    person:
                        name :
                            firstName: 'Bob'
                            lastName: 'Sass' 

            window.model = new MyModel

            FormView = Backbone.View.extend
                initialize: ->
                    @modelBinder = new Backbone.ModelBinder();
                    @modelBinder.bind(@model,@el)
                el: '#frm'

            view = new FormView model: model

    </script>


<body>
    <form method="post" action="/test" id='frm'>
        <div id="welcome"> Welcome, <span id='person.name.firstName'></span> <span id='person.name.lastName'></span>
        <br><br>
        Edit your information:
            <input type="text" name="person.name.firstName" value="zz"/>
            <input type="text" name="person.name.lastName" value="nn"/></div>
    </form>
@cooolbasha
Copy link
Author

Is the issue in the modelBinder or in Nested Model..

@gkatsev
Copy link
Collaborator

gkatsev commented Jan 11, 2014

We recently updated backbone-nested to work with Backbone 1.x. Can you retest and see whether it is still breaking?
Also, looking at the readme of modelbinder, the author seems to think that backbone-nested should work with it as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants