I'm trying to create a background image but I can't seem to being able to do so.. I looked at this question:
Nativescript background-image fullscreen
But without any luck. It doesn't show enough of the markup and also the OP there doesn't seem to use nativescript-angular because when you use <Page></Page> as suggested you get an error.
And this issue says that Page shouldn't be used with angular, and I'm positive I've read the same thing in the docs.
I use this css:
.login-page {
width: 100%;
height: 100%;
padding: 40px 60px;
background-image: ~/assets/img/login.jpg;
background-position: 50% 50%;
background-size: cover;
background-color: blue;
}
With this template:
<StackLayout class="login-page text-center" orientation="vertical" [formGroup]="loginForm">
<StackLayout class="input-field m-b-20">
<TextField class="input input-rounded" formControlName="email" hint="Email"></TextField>
</StackLayout>
<StackLayout class="input-field">
<TextField class="input input-rounded" formControlName="password" hint="Password" secure="true"></TextField>
</StackLayout>
</StackLayout>
The image is at app/assets/img/login.jpg. Any ideas why this isn't working?
Pagedirectly, but you can programmatically. InngOnInitfor the component, you canthis.page.backgroundImage = "res://login"- jalal