Famous / famous-angular

Bring structure to your Famo.us apps with the power of AngularJS. Famo.us/Angular integrates seamlessly with existing Angular and Famo.us apps.
https://famo.us/angular
Mozilla Public License 2.0
1.92k stars 275 forks source link

fa-container-surface options #193

Closed zoneblaze closed 10 years ago

zoneblaze commented 10 years ago

When I apply fa-options to a container surface, e.g. a background colour, it works initially, but if I try and assign a new colour property afterwards through the same scope object to the same container surface, the background colour doesn't change? Not sure if this is expected behaviour, can you only apply fa-options on a container surface once?

steveblue commented 10 years ago

A vanilla famo.us ContainerSurface also has the ability to support "properties", which allows you to set CSS attributes. Not having this ability is blocking me from implementing something similar to a ScrollContainer with a ContainerSurface encapsulating a ScrollView.

zackbrown commented 10 years ago

fa-options watching is not yet implemented on a fa-container-surface, but it's on the tracker and should come together soon. fa-options is pretty standard across Famo.us components, so we might end up breaking it out into its own directive.

Also remember that you always have the ability to manipulate the Famo.us components directly using $famous.find. Using this, you can set properties and options directly on any vanilla Famo.us components, which should keep you from getting stuck in the meantime.

zoneblaze commented 10 years ago

Thanks for the tip. I can work with that. I just wasn't sure if that was a bug or if I was doing something wrong as usually you expect model changes to pick up in the view in Angular.

steveblue commented 10 years ago

yes, so this does work

                   var container = $famous.find('.container-surface')[0].renderNode;
                   container.properties = {
                     backgroundColor: '#ABABAB'
                   };
zackbrown commented 10 years ago

live fa-options updates should now work (on any Famo.us element that uses the setOptions API, which should be just about everything) without needing to use $famous.find, thanks to @marlonpp's PR #202.

One other note on $famous.find: you can use any CSS selectors, including classes, ids, or tag types to look up elements (e.g. $famous.find('#my-element')[0] or $famous.find('fa-container-surface')[0])