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

Add fa-classes attribute. #150

Closed trusktr closed 10 years ago

trusktr commented 10 years ago

In this example:

            <fa-surface
                fa-classes="['backfaceVisibility']"
                fa-size="[window.innerWidth*0.8, window.innerHeight*0.8]"
                fa-properties="{
                    'backgroundImage'   : 'url(/images/Federal-Reserve-Seal.png)',
                    'backgroundPosition': 'center center',
                    'backgroundRepeat'  : 'repeat',
                    'backgroundSize'    : 'contain',
                }">
                <h1>hello</h1>
            </fa-surface>

the fa-classes doesn't add classes to the generated element, but classes is a valid property that can be defined in the options passed to new Surface(). i.e.:

    var logo = new Surface({
        properties: {
             ...
        },
        classes: ['backfaceVisibility'] // right here.
    });

Using just a class attribute on the <fa-surface> works, but it'd still be nice to support all of the native famo.us APIs one-to-one.

zackbrown commented 10 years ago

We should really support just one or the other of string classes vs an array of classes. Supporting both would result in undefined or at least unintuitive behavior. Given that we are discussing an HTML interface, per HTML conventions it feels more natural to me to support a string of classes vs passing in an array of classes. The latter can be transformed to the former with a simple .join(' ') The setClasses method is still available on the Surface itself if imperative manipulation is ever needed. I will go ahead and close this, but let's discuss more if you feel strongly about it.