I have two ember objects available in a function, but I cant seem to figure out how to create a binding between them, since I cant reference them via a static path. The objects are referenced to as var aand var bin the javascript function.
How to create a binding between two objects when I can’t reference one of them like App.controller.content or similar?
Or alternatively; can I reference to a specific ember object in a ArrayControllers content via some static path? I have tried many variations of the getPath method on both objects but cant seem to get it to return something useful.
All paths have to be relative to “this” (whatever the object is, or what was in the apply) or as you stated, a global path. But there is nothing stopping you from setting relative paths once you are in the function you mentioned.
Once they have reference to each other, you can add relative paths to your hearts content. I would prefer to do this over creating a method with relative scope, so you don’t miss any updating values.
I created a simple jsfiddle to show you what I mean. I would normally have created a View etc, but was trying to keep it to only a few lines.
Now that being said, I feel like you should be able to bind directly between objects by setting a _to or _from on a Binding. But looking through that code, it seems like everything is relative & path based. Maybe the transformation stuff will change in the 1.0 release of the framework.