Getting started issue - binding to view doesn't work for me

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting started issue - binding to view doesn't work for me

Tom Chiverton
I'm doing

            MyApp=Em.Application.create({
                 VERSION: "0.0.1"

             });

             MyApp.president = Ember.Object.create({
              firstName: "Barack",
              lastName: "Obama",
              fullName: function() {
                return this.get('firstName') + ' ' + this.get('lastName');
              // Tell Ember that this computed property depends on firstName
              // and lastName
              }.property('firstName', 'lastName')
            });

            var myView = Em.View.create({
                templateName: "my-template",
                fullNameBinding:'MyApp.president.fullName',
                firstNameBinding:'MyApp.president.firstName'
            });
            myView.appendTo(divToControl);

            MyApp.president.firstName='foo';//update via binding

The template is just
MyApp of  {{firstName}} {{fullName}}

But my div just contains
MyApp of

I don't see why the details aren't being filled in. I'm sure I missed an obvious step but I can't see what it is.

Any pointers for debugging ? Or a second pair of eyes that can see the obvious mistake ?

MyApp is a private variable inside the function that creates and appends the view.

Tom
Reply | Threaded
Open this post in threaded view
|

Re: Getting started issue - binding to view doesn't work for me

Nicolas Petton
I think you sent this email to the wrong mailing-list :)

Didn't you mean Ember instead of Amber?

Cheers!
Nico

Tom Chiverton <[hidden email]> writes:

> I'm doing
>
>             MyApp=Em.Application.create({
>                  VERSION: "0.0.1"
>
>              });
>
>              MyApp.president = Ember.Object.create({
>               firstName: "Barack",
>               lastName: "Obama",
>               fullName: function() {
>                 return this.get('firstName') + ' ' + this.get('lastName');
>               // Tell Ember that this computed property depends on firstName
>               // and lastName
>               }.property('firstName', 'lastName')
>             });
>
>             var myView = Em.View.create({
>                 templateName: "my-template",
>                 fullNameBinding:'MyApp.president.fullName',
>                 firstNameBinding:'MyApp.president.firstName'
>             });
>             myView.appendTo(divToControl);
>
>             MyApp.president.firstName='foo';//update via binding
>
> The template is just
> MyApp of  {{firstName}} {{fullName}}
>
> But my div just contains
> MyApp of
>
> I don't see why the details aren't being filled in. I'm sure I missed an
> obvious step but I can't see what it is.
>
> Any pointers for debugging ? Or a second pair of eyes that can see the
> obvious mistake ?
>
> MyApp is a private variable inside the function that creates and appends
> the view.
>
> Tom
Reply | Threaded
Open this post in threaded view
|

Re: Getting started issue - binding to view doesn't work for me

Esteban A. Maringolo
Funny. I never expected this to happen.

Maybe Amber should be renamed to Smalltalk.js :)


Reply | Threaded
Open this post in threaded view
|

Re: Getting started issue - binding to view doesn't work for me

Tom Chiverton
In reply to this post by Nicolas Petton
I did, oops :-)

On Friday, August 3, 2012 5:57:37 PM UTC+1, nicolas petton wrote:
I think you sent this email to the wrong mailing-list :)

Didn't you mean Ember instead of Amber?

Cheers!
Nico

Tom Chiverton <[hidden email]> writes:

> I'm doing
>
>             MyApp=Em.Application.create({
>                  VERSION: "0.0.1"
>
>              });
>
>              MyApp.president = Ember.Object.create({
>               firstName: "Barack",
>               lastName: "Obama",
>               fullName: function() {
>                 return this.get('firstName') + ' ' + this.get('lastName');
>               // Tell Ember that this computed property depends on firstName
>               // and lastName
>               }.property('firstName', 'lastName')
>             });
>
>             var myView = Em.View.create({
>                 templateName: "my-template",
>                 fullNameBinding:'MyApp.president.fullName',
>                 firstNameBinding:'MyApp.president.firstName'
>             });
>             myView.appendTo(divToControl);
>
>             MyApp.president.firstName='foo';//update via binding
>
> The template is just
> MyApp of  {{firstName}} {{fullName}}
>
> But my div just contains
> MyApp of
>
> I don't see why the details aren't being filled in. I'm sure I missed an
> obvious step but I can't see what it is.
>
> Any pointers for debugging ? Or a second pair of eyes that can see the
> obvious mistake ?
>
> MyApp is a private variable inside the function that creates and appends
> the view.
>
> Tom