dart-archive / angular_analyzer_plugin

WORK MOVED TO dart-lang/angular repository
https://github.com/dart-lang/angular/tree/master/angular_analyzer_plugin
68 stars 13 forks source link

Support binding to style #425

Open MichaelRFairhurst opened 7 years ago

MichaelRFairhurst commented 7 years ago

Also handle security for it.

Not sure why it isn't a part of dart:html in a usable way, and I'm not sure if angular expects to get a String or one of those SomeStyleThing classes.

zoechi commented 7 years ago

There are two ways of binding to styles

[style.background-color]="'red'"

or

[ngStyle]="{'background-color': 'red', 'margin': 'solid 3px bue'}"

The classes CssStyleDeclarationBase and CssStyleDeclaration seem to list all style properties.

The properties in class CssStyleDeclaration have annotations like @JSName('backgroundColor'), but CssStyleDeclarationBase doesn't have the these annotations.

See also

https://webdev.dartlang.org/angular/guide/template-syntax#!#other-bindings https://webdev.dartlang.org/angular/guide/template-syntax#!#ngStyle