Reputation: 3632
I have not worked with Angular 2, but I know css and jquery.
I can't understand this syntax inside component
@Component({
selector: 'sites-stats',
styleUrls: ['./sites.stats.navbar.component.scss'],
template: `
<div [sticky]="{'zIndex': 99}">
</div>
`
})
I mean <div [sticky]="{'zIndex': 99}">
With this way my div has position: fixed;z-index:99
What should I search to understand this style syntax inside component?
BTW I need to add top to this div, I tried <div [sticky]="{'zIndex': 99,'top':'2rem'}">
but it didn't work
Upvotes: 0
Views: 93
Reputation: 16261
You have to do it as below:
[style]="{'z-index': '99','top':'2rem'}"
This calls style-binding
.
Learn here:https://coursetro.com/posts/code/24/Angular-2-Class-&-Style-Binding-Tutorial
And here:https://alligator.io/angular/style-binding-ngstyle-angular/
Upvotes: 2