Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Angular2 like class and style property binding [class.property]="expresion" #4956

Closed
wszerad opened this issue Feb 17, 2017 · 6 comments

Comments

@wszerad
Copy link

wszerad commented Feb 17, 2017

Example

v-bind:class.class-name="expression"
//is equivalent to
v-bind:class="{'class-name': expression}"

More about:
https://scotch.io/tutorials/angular-2-classes-with-ngclass-and-ngstyle#using-the-styleproperty-binding

@posva
Copy link
Member

posva commented Feb 17, 2017

I don't think it's a good idea to introduce another syntax for classes that doesn't achieve anything new. The only gain I see here is 5 characters.

It's better having a flexible, explicit syntax that 3 convenient short ones

@smolinari
Copy link

smolinari commented Feb 17, 2017

Plus, if you use the shorthand version, you get the 5 characters plus 1 back. 😄

:class="{'class-name': expression}"

Scott

@yyx990803
Copy link
Member

yyx990803 commented Feb 17, 2017

Not going to happen, sorry. I don't really see the point of introducing alternative syntax.

@xingchch
Copy link

this feture is what I need , It will make things more easy.

@xingchch
Copy link

what I need is :class="{'class-name': (this.somethings === "something")}"

@Akryum
Copy link
Member

Akryum commented Mar 21, 2017

You can do exactly that already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants