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

Dart doesn't do [class] #6901

Closed
kwalrath opened this issue Feb 5, 2016 · 8 comments
Closed

Dart doesn't do [class] #6901

kwalrath opened this issue Feb 5, 2016 · 8 comments

Comments

@kwalrath
Copy link
Contributor

kwalrath commented Feb 5, 2016

If you use [className] instead, it works.

Misko says, "We alias [class] to [className] so it looks like the alias is broken in Dart."

Example:

// In Dart code:
class AppComponent {
  //...
  String badCurly = 'bad curly'; // Works with [className].
  //...
}

<!-- In HTML: -->
<div class="bad curly special">Bad curly special</div>

<!-- reset/override all class names with a binding  -->
<div class="bad curly special"
     [className]="badCurly">Bad curly</div>

If you change [className] to [class], it stops working.

See the whole sample in angular/angular.io#758. It's based on the TypeScript Template Syntax page, which has a plunkr for its sample.

@kwalrath
Copy link
Contributor Author

cc @mhevery

@pkozlowski-opensource
Copy link
Member

class -> className seems to be properly mapped in Dart (

) so there is sth else that must be going here.

I suspect that it might be interference of the class and [class] used on the same element. @kwalrath would you mind changing to <div [class]="badCurly">Bad curly</div> and see if classes from the badCurly are applied?

@kwalrath
Copy link
Contributor Author

kwalrath commented Mar 1, 2016

Nope, they aren't applied. Here's what I see with <div [class]="badCurly">Bad curly</div>:

image

Here's what I see with <div class="bad curly special" [class]="badCurly">Bad curly</div>:

image

@kwalrath
Copy link
Contributor Author

kwalrath commented Mar 2, 2016

And, just to be complete, here's the correct version that I see when I use <div class="bad curly special" [className]="badCurly">Bad curly</div>:

image

@kwalrath
Copy link
Contributor Author

kwalrath commented Mar 2, 2016

You can see the complete code in the template-syntax example. The HTML code is in lib/app_component.html, and the Dart code is in lib/app_component.dart.

@pkozlowski-opensource
Copy link
Member

Obsolete as Dart-specific.

@kwalrath
Copy link
Contributor Author

kwalrath commented Aug 8, 2016

This issue was moved to angulardart/angular#43

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants