X Tutup
Skip to content

feat(CSSClass): add support for string and array expresions#2664

Closed
pkozlowski-opensource wants to merge 1 commit intoangular:masterfrom
pkozlowski-opensource:class_with_list
Closed

feat(CSSClass): add support for string and array expresions#2664
pkozlowski-opensource wants to merge 1 commit intoangular:masterfrom
pkozlowski-opensource:class_with_list

Conversation

@pkozlowski-opensource
Copy link
Copy Markdown
Member

This adds support for lists and strings arguments to the [class] directive. I've got few improvements on my mind to the initial implementation, but at least this is the starting point that we can improve upon.

Now, I would like to argue that we should rename this class to NgClass and make it match the [ng-class] selector. Here are my arguments:

  • It reduces "magic" in the framework where the "class" is special in some kind. The entire system is easier to reason about when there are less special rules to follow
  • It reduces unnecessary work on "static" class attributes
  • It makes migration (both in terms of code and learning) easier

Closes #2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add return type : void everywhere it's applicable

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, will do!

@naomiblack naomiblack added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews state: PR and removed state: PR labels Jun 23, 2015
@naomiblack
Copy link
Copy Markdown
Contributor

@vicb should this otherwise have the pr_state LGTM from you or is there more significant review and fixing needed?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v.split(' ') (BTW you can now use /.../g - g flag is mandatory to transpile to Dart)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not adressed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vicb I didn't change this one since I saw that you had some problems with regexp literals in #2695. I guess this is not a blocking point, right? But I would be more than happy to change this one as soon as we sure that this works both in JS and Dart.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean using String.split() here and get rid of the RegExp.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right. I see! Will do asap!

@vicb
Copy link
Copy Markdown
Contributor

vicb commented Jun 23, 2015

Added LGTM and more feedback

@pkozlowski-opensource pkozlowski-opensource removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jun 23, 2015
@pkozlowski-opensource
Copy link
Copy Markdown
Member Author

I've cleaned up based on comments from @vicb (thnx for the review!). I'm not sure if anyone needs to review since it doesn't have "action: merge" label. I would love to have some feedback on this one from @vsavkin - especially the way I handle type switches.

@pkozlowski-opensource pkozlowski-opensource added this to the alpha-28 milestone Jun 23, 2015
@pkozlowski-opensource
Copy link
Copy Markdown
Member Author

Adding to m.28 since the associated issue is in m.28

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff.wrapped instanceof IterableChanges ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ? the methods you call below expect that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it doesn't change much, I've got no objections changing this. Will do.

@vicb
Copy link
Copy Markdown
Contributor

vicb commented Jun 23, 2015

I have added more comments.

.split() has yet to be adressed

@pkozlowski-opensource
Copy link
Copy Markdown
Member Author

@vicb see my comments above.

@googlebot
Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

@pkozlowski-opensource
Copy link
Copy Markdown
Member Author

@vicb I've addressed all your latest comments apart from removing RegExpWrapper. Not sure what is going on and I've got very limited time / access to Inet atm. Could we land this one as-is (I would like to avoid further rebases) and remove the RegExpWrapper in a separate PR?

@vicb
Copy link
Copy Markdown
Contributor

vicb commented Jun 24, 2015

If this is ready to be merged I can fixup the commit to remove the RegExp before merging into master

@pkozlowski-opensource
Copy link
Copy Markdown
Member Author

@vicb if you know how to remove RegExp, feel free to do so while merging. Would be much appreciated!

@vicb
Copy link
Copy Markdown
Contributor

vicb commented Jun 24, 2015

replaced by #2720

@angular-automatic-lock-bot
Copy link
Copy Markdown

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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ng-class equivalent behaviour

4 participants

X Tutup