@angular/flex-layout
Advanced tools
Changelog
2.0.0-beta.5 (2017-02-09)
asObservable()
for rxjs operators (#133) (6e46561), closes #125ObservableMediaService
opaque token. Developers now simply use the ObservableMedia class to inject the service.before
constructor( @Inject(ObserverableMediaService) media:any ) { ... }
after
constructor(private media:ObservableMedia) { ... }
ObservableMedia
to inject instance of serviceMediaService::asObservable()
to get instance of observable// RxJS
import 'rxjs/add/operator/map';
import {ObservableMedia} from '@angular/flex-layout';
@Component({ ... })
export class MyComponent {
constructor( media:ObservableMedia ) {
media.asObservable()
.map( (change:MediaChange) => change.mqAlias == 'md' )
.subscribe((change:MediaChange) => {
let state = change ? `'${change.mqAlias}' = (${change.mediaQuery})` : "";
console.log( state );
});
}
}
Previously releases used FlexLayoutModule.forRoot().
This has been deprecated and will output a console.warn()
if used.
-before-
@NgModule({
declarations : [...],
imports : [
CommonModule,
FlexLayoutModule.forRoot()
]
})
export class DemosResponsiveLayoutsModule { }
-after-
@NgModule({
declarations : [...],
imports : [ CommonModule, FlexLayoutModule ]
})
export class DemosResponsiveLayoutsModule { }
<a name="2.0.0-beta.4"></a>
Changelog
2.0.0-beta.4 (2017-01-27)
ObservableMediateService
to inject instance of MediaService
MediaService::asObservable()
to get instance of observable// RxJS
import 'rxjs/add/operator/map';
@Component({ ... })
export class MyComponent {
constructor( @Inject(ObservableMediaService) media) {
media.asObservable()
.map( (change:MediaChange) => change.mqAlias == 'md' )
.subscribe((change:MediaChange) => {
let state = change ? `'${change.mqAlias}' = (${change.mediaQuery})` : ""
console.log( state );
});
}
}
<a name="2.0.0-beta.3"></a>
Changelog
2.0.0-beta.3 (2017-01-17)
<a name="2.0.0-beta.2"></a>