Error with Angular Universal SSR CSS animation transformation

I recently implemented Angular universal into my application by following the step-by-step guide provided at https://angular.io/guide/universal. While the process itself was straightforward, I am currently facing a challenge with the following error:

ERROR Error: Unable to build the animation due to the following errors: The provided animation property "transform" is not a supported CSS property for animations The provided animation property "transform" is not a supported CSS property for animations

This issue seems to stem from a simple button that utilizes a keyframe animation featuring transform: rotate(0deg). The button, which has a circular shape, should roll from right to left upon loading.

Is there a workaround available to resolve this problem? I strongly believe that 'transform' is indeed a valid CSS property for animations.

Edit: Within a component's SCSS file, I have utilized the transform Property. This component displays static content and represents an entire webpage. The CSS code snippet in question is as follows:

  .roll-in {  
    animation: 2s linear 0s 1 animation;
    animation-fill-mode: both;
}

@keyframes animation {
    0% {
        left: 110%;
    }

    10% {
        transform: rotate(0deg);
        left: 110%;
    }

    100% {
        transform: rotate(-720deg);
        left: 0px;
    }
}

Upon running the application using serve:ssr, the element appears to lack the animation attribute.

Answer №1

When it comes to server-side rendering, the issue may arise when the animation initiates during the rendering process on the server itself. In such cases of SSR, loading animations on the server version serves no purpose.

The solution is to load animations exclusively in the Browser platform version. This ensures that animations kick in only after the page has been fully rendered in the browser view. Below is an illustration:

component.ts

import { Component, Inject } from '@angular/core';
import { PLATFORM_ID } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';

@Component({
  selector: 'my-animated-component',
  templateUrl: './my-animated-component.html'
})
export class MyAnimatedComponent{
  isBrowser: boolean;

  constructor( @Inject(PLATFORM_ID) platformId: Object) {
    this.isBrowser = isPlatformBrowser(platformId);
  }
}

In markup

 <div *ngIf="isBrowser">
    <my-animated-component></my-animated-component>
 </div>

It is advisable to utilize Angular's native animations rather than CSS animations. For a functional example, refer to: https://stackblitz.com/edit/angular-animate-keyframes

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Images in the background that adapt to the screen size

Hello, I am a beginner in React and looking for assistance with my home.js code: I am attempting to use an image as a background for my page, but I am struggling to make it adjust to the window size. I have tried using properties like background-repeat: n ...

What is the best way to position an element to the right of other elements within a div?

My goal is to style my button like this : desired look However, I'm unsure of the necessary steps to achieve this. Here is my HTML code : <div class="content" *ngIf="loading==false" > <div class="product" ...

"Enhance your website with a unique Bootstrap 5 carousel featuring multiple

As a beginner in Bootstrap, I am currently working on an ecommerce template to learn about Bootstrap 5. I am interested in creating a carousel that displays multiple slides at once, like a products slider with left and right arrows. Is this possible in Bo ...

Angular child component displaying of table data is not looping properly

Currently, I am using Angular 13 along with Bootstrap 3 to develop an application that consists of two main components: form-component (dedicated to inputting user details) and list-component (designed to showcase all data in a table format). Within the HT ...

Experiencing difficulty aligning the Material UI grid to float on the right side

I'm currently in the learning phase of material-ui and encountering an issue with floating the grid content to the right side. Despite trying alignItems="flex-start" justify="flex-end" direction="row" in the container grid, as well as using the css p ...

click event on ion card

Attempting to handle a click event within an ion-card using Ionic 5.0.2 version has presented some challenges. Despite my efforts, I have not been successful in handling the event with the expected function. Here is a snippet of my code: Dynamic card list ...

Having Trouble Displaying Data in HTML After Making a Get Request

Upon initialization, I retrieve the data using ngOnInit() ngOnInit(): void { this.http.get<any>(this.ROOT_URL + this.cookieService.get('cookie-name')).subscribe( function(res) { this.tableData = res.atVendor; co ...

The cards in the Bootstrap layout stack on top of one another when viewed on a mobile screen

I have a "flipping card" and another bootstrap 4 card positioned side by side. However, when tested on a mobile screen using Chrome's dev console, the second card overlaps the flipping card and covers it completely. To provide some context, I've ...

The container in Bootstrap's CSS now appears when the navigation bar is present

Experiencing a minor issue here. I am attempting to create a layout with a navigation positioned in the top right corner, and the main content contained within a separate container below it. The problem I am facing is that the content container seems to b ...

Having trouble manipulating text or values of angular elements with Selenium and Python

https://i.stack.imgur.com/vZdo0.png I am facing an issue with a date input field that does not have a calendar or dropdown for selection. I tried using driver.find_element_by_id('dataInicio').send_keys(date_value) but it doesn't seem to work ...

The CSS code is failing to update the text color

My latest project involves using Bootstrap4 to create a greenfooter div, which includes a container with four columns for organization. However, I seem to have run into some issues when it comes to styling the text within this setup. In particular, I want ...

Adjusting height dynamically with CSS based on font size

Below is a link followed by a span element <a href="#" style="display:inline-block;font-size:900%">12</a> <span display="block">ACTIVE</span> The issue arises when the 'a' element does not have a specific height, causing ...

How might the issue of update activation affecting lazy loading in an Angular PWA app specifically manifest itself?

I am looking for a way to trigger an update activation in my Angular PWA app. I came across a note in the documentation from the official Angular website (https://angular.io/guide/service-worker-communications) that says: "Doing this could break lazy-load ...

Links repository

My goal is to create a layout similar to the one shown in this image: https://i.sstatic.net/DaXa0.png where there is one container for the top information and another container for links like NEWS. The issue I am facing is that the links are not stay ...

Creating a consistent height for Bootstrap 5 Carousel items with varying sizes

I am currently utilizing Bootstrap 5 carousel to display a collection of user-uploaded images that vary in height and width. I am seeking to create a carousel with responsive height and scaled/filled images. Below is the HTML + CSS code snippet I am using ...

Having trouble locating the withArgs() method of the Spy class when using Jasmine and TypeScript

As per the Jasmine documentation, there is a method called withArgs() in the Spy object. spyOn(someObj, 'func').withArgs(1, 2, 3).and.returnValue(42); In the TypeScript-adapted version, I am unable to locate this method. My project was initiali ...

Guide to creating a dynamic illumination using CSS, HTML, and JS

Can you help me create a unique lighting effect for a specific section of my webpage? I'm curious about the techniques needed to achieve a similar effect as seen on another webpage. Is it feasible to create this effect using only CSS and HTML, or are ...

Unable to store the array in the local storage

Background: In an attempt to implement a "Favourites List" feature where users can add favorite categories with heart icons on the home page, I encountered challenges. Despite searching for a logical flow on Google, I couldn't find a helpful solution. ...

Is there a way to align these side by side?

Is it a silly question? Perhaps. But I can't seem to figure out how to align my text and colorpicker on the same line instead of two. Take a look at my fiddle. I've tried removing display:block and clear:both, but that didn't do the trick. H ...

Creating a Modern Tooltip Menu with HTML, CSS, and Bootstrap

My goal is to design a menu that opens to the right, similar to a tooltip. I have experimented with different bootstrap techniques, but I am encountering difficulties in including HTML li elements within the tooltip. https://i.sstatic.net/mAHKS.jpg ...