Giter Site home page Giter Site logo

adaojunior / ng_mediaquery Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 5 KB

A Angular 2 directive that can be used to data bind to a CSS media query.

Home Page: https://pub.dartlang.org/packages/ng_mediaquery

License: MIT License

HTML 14.85% Dart 85.15%

ng_mediaquery's Introduction

ng_mediaquery

Inspired by iron-media-query

A angular 2 directive that can be used to data bind to a CSS media query.

How to use

The query property is a CSS media query, learn more about them here. The matches property is a boolean representing whether the page matches that media query.

<media-query query="(max-width : 768px)" [(matches)]="isSmallDevice"></media-query>

<div *ngIf="isSmallDevice">
   Some awesome content for small devices
</div>

isSmallDevice must be a property in your controller. When running on Dartium *ngIf may complain if isSmallDevice is null, you can solve that but setting a non-null value to it, it will be updated as soon as media-query gets its first result.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.