Last active
June 14, 2017 09:50
-
-
Save EddyVerbruggen/cf79273916c9242a9ac26b2714f53479 to your computer and use it in GitHub Desktop.
App component specific tablet CSS file in NativeScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from "@angular/core"; | |
import { DeviceType } from "ui/enums"; | |
import { device } from "platform"; | |
import { Page } from "ui/page"; | |
@Component({ | |
moduleId: module.id, | |
selector: "my-component", | |
templateUrl: "my-component.html", | |
styleUrls: ["my-component.css"] | |
}) | |
export class MyComponent implements OnInit { | |
constructor(private page: Page) { | |
} | |
ngOnInit(): void { | |
if (device.deviceType === DeviceType.Tablet) { | |
this.page.className = "tablet"; | |
this.page.addCssFile("~/pages/my-component/my-component.tablet.css"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment