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

API Documentation for ngStyle and ngClass uses different syntax #215

Closed
molcik opened this issue Mar 13, 2017 · 5 comments · Fixed by #228
Closed

API Documentation for ngStyle and ngClass uses different syntax #215

molcik opened this issue Mar 13, 2017 · 5 comments · Fixed by #228
Labels
bug has pr A PR has been created to address this issue
Milestone

Comments

@molcik
Copy link

molcik commented Mar 13, 2017

Bug

In API documentation is written to use ngClass and ngStyle but it doesn't work. To use responsive features you have to use class and style

Example

To change font-size you have to use:
[style.sm]="{'font-size.px': 40}"
instead of:
[ngStyle.sm]="{'font-size.px': 40}"

https://plnkr.co/edit/b7XxsdgBAISf0KzRDwte?p=preview

Version

@angular/flex-layout: ^2.0.0-rc.1

@intellix
Copy link

I tripped up over this as well :)

@ThomasBurleson
Copy link
Contributor

ThomasBurleson commented Mar 13, 2017

This has been fixed in the nightly builds:

To use the most recent, pre-release builds, change this configuration in your Plunker:

config.ts

'@angular/flex-layout' : 'https://rawgit.com/angular/flex-layout-builds/master/bundles/flex-layout.umd.js',

test-app.ts
    Adjust the width to watch font size change:
    instead of 
    <div class="containerX" [ngStyle.sm]="{'font-size': '20px'}">
      <div [fxLayout]="direction" (click)="toggleDirection()" class="colored box" >
        <div fxFlex="20">  fxFlex="20"  </div>
        <div fxFlex="60">  fxFlex="60"  </div>
        <div fxFlex >      fxFlex       </div>
      </div>
    </div>

@ThomasBurleson
Copy link
Contributor

ThomasBurleson commented Mar 13, 2017

Also see PR #204

@ThomasBurleson ThomasBurleson added this to the v2.0.0-rc.2 milestone Mar 13, 2017
@ThomasBurleson ThomasBurleson added the has pr A PR has been created to address this issue label Mar 13, 2017
@ThomasBurleson
Copy link
Contributor

ThomasBurleson commented Mar 27, 2017

@molcik, @intellix - Please see #228 for more improvements regarding Responsive APIs for class, style, ngClass, and ngStyle. You can also review our online ngClass API Docs

It should be noted that class assignments are considered destructive and will overwrite any existing class names currently in use. While ngClass is addition/subtractive based on the expressions provided.

Depends on PR #228

ThomasBurleson added a commit that referenced this issue Mar 27, 2017
…rategy.OnPush strategies

* fix(ngClass):  properly differentiate between `ngClass` and `class` api usages
  *  `class.<xxx>` are destructive overrides (as seen in `NgClass::klass`)
  *  `ngClass.<xxx>` use iterables to merge/enable/disable 0...n classes
* fix(ngClass,ngStyle): support ChangeDetectionStrategy.OnPush
  * Add support for both **OnPush** change detection strategies and for @input changes.

>  @see https://plnkr.co/edit/jCICQ1GXFnzFqFTFlXwh?p=preview

fixes #206, fixes #215.
ThomasBurleson added a commit that referenced this issue Mar 28, 2017
…rategy.OnPush strategies

* fix(ngClass):  properly differentiate between `ngClass` and `class` api usages
  *  `class.<xxx>` are destructive overrides (as seen in `NgClass::klass`)
  *  `ngClass.<xxx>` use iterables to merge/enable/disable 0...n classes
* fix(ngClass,ngStyle): support ChangeDetectionStrategy.OnPush
  * Add support for both **OnPush** change detection strategies and for @input changes.

>  @see https://plnkr.co/edit/jCICQ1GXFnzFqFTFlXwh?p=preview

fixes #206, fixes #215.
ThomasBurleson added a commit that referenced this issue Mar 28, 2017
…rategy.OnPush strategies

* fix(ngClass):  properly differentiate between `ngClass` and `class` api usages
  *  `class.<xxx>` are destructive overrides (as seen in `NgClass::klass`)
  *  `ngClass.<xxx>` use iterables to merge/enable/disable 0...n classes
* fix(ngClass,ngStyle): support ChangeDetectionStrategy.OnPush
  * Add support for both **OnPush** change detection strategies and for @input changes.
* fix class lt-<xx> selectors

>  @see https://plnkr.co/edit/jCICQ1GXFnzFqFTFlXwh?p=preview

fixes #206, fixes #215.
ThomasBurleson added a commit that referenced this issue Mar 28, 2017
…rategy.OnPush strategies

* fix(ngClass):  properly differentiate between `ngClass` and `class` api usages
  *  `class.<xxx>` are destructive overrides (as seen in `NgClass::klass`)
  *  `ngClass.<xxx>` use iterables to merge/enable/disable 0...n classes
* fix(ngClass,ngStyle): support ChangeDetectionStrategy.OnPush
  * Add support for both **OnPush** change detection strategies and for @input changes.
* fix class lt-<xx> selectors

>  @see https://plnkr.co/edit/jCICQ1GXFnzFqFTFlXwh?p=preview

fixes #206, fixes #215.
tinayuangao pushed a commit that referenced this issue Mar 29, 2017
…rategy.OnPush strategies (#228)

* fix(ngClass):  properly differentiate between `ngClass` and `class` api usages
  *  `class.<xxx>` are destructive overrides (as seen in `NgClass::klass`)
  *  `ngClass.<xxx>` use iterables to merge/enable/disable 0...n classes
* fix(ngClass,ngStyle): support ChangeDetectionStrategy.OnPush
  * Add support for both **OnPush** change detection strategies and for @input changes.
* fix class lt-<xx> selectors

>  @see https://plnkr.co/edit/jCICQ1GXFnzFqFTFlXwh?p=preview

fixes #206, fixes #215.
karlhaas pushed a commit to karlhaas/flex-layout that referenced this issue May 3, 2017
…rategy.OnPush strategies (angular#228)

* fix(ngClass):  properly differentiate between `ngClass` and `class` api usages
  *  `class.<xxx>` are destructive overrides (as seen in `NgClass::klass`)
  *  `ngClass.<xxx>` use iterables to merge/enable/disable 0...n classes
* fix(ngClass,ngStyle): support ChangeDetectionStrategy.OnPush
  * Add support for both **OnPush** change detection strategies and for @input changes.
* fix class lt-<xx> selectors

>  @see https://plnkr.co/edit/jCICQ1GXFnzFqFTFlXwh?p=preview

fixes angular#206, fixes angular#215.
@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 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug has pr A PR has been created to address this issue
Projects
None yet
3 participants