IE11 not running Angular code inline as expected

Currently in the process of developing an AngularJS application, I came across a strange issue that I have never encountered before. It may be a simple fix, but I am unsure of the exact terminology to search for the right solution, so I apologize in advance if this is a common problem.

This is a snippet of my HTML code:

<div class="parent">
    <div ng-repeat="item in itemList" style="left: {{100 / itemList.length}}px">{{item}}</div>
</div>

The itemList contains arbitrary data. The problem lies in the fact that the code inside the brackets is not being executed at all in IE11. While other browsers display a result of 25% when there are 4 values in itemList, IE11 simply interprets it as '{{100/itemList.length}}px', which is invalid CSS.

I attempted to convert the code to use ngStyle instead, but it had no effect. Does anyone know why this specific issue occurs in IE11 and how to resolve it?

Once again, I am not entirely sure if I am using the correct terminology, so any guidance in that regard would be greatly appreciated.

UPDATE

I also tried using ngStyle as recommended in a similar question found in the comments. However, it still does not work, though there are no parse errors.

ng-style="{left: 'calc(' + (100 / itemList.length) + '% - 10px);'}" 

One possible explanation could be that on the initial page load, itemList is empty. But I would expect it to update during the digest cycle. Even after inspecting the element, 'left' does not show any assigned value.

Answer №1

Shoutout to Phil for the tip!

One key difference when using ngStyle compared to regular style attribute is that you should not include semi-colons in your style string.

style="left: 50%;"

The example above demonstrates valid CSS.

ng-style="{left: '50%;'}"

However, the example above will not work unless the semi-colon is removed.

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

Ways to adjust the brightness of any color when hovered over

Is it possible to create a universal effect where an element becomes darker or lighter when hovered over, regardless of the initial color? Here is an example: .change-color{ Background:green; width:100px; height:100px } .change-color:hover{ Background ...

What is the best way to synchronize the image dimensions and source when dynamically loading images?

I am facing an issue with a function that updates images by altering the src and css (width/height) of an IMG tag within the document. Below is a simplified example to demonstrate the problem: updateImage = function(src, width, height) { $("#changeMe"). ...

Is it possible to emphasize a duration of 25 minutes on an analog clock by utilizing CSS gradients?

I am in the process of incorporating a countdown timer but with an analog clock rather than a digital one. My objective is to emphasize the next 25 minutes as a circle sector that commences from the minute hand on the clock. Here is what I have developed ...

Tips for effectively sizing a logo within a Bootstrap navbar

<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Bootstrap CSS --> <link ...

Make sure to confirm that 'tables-basic' is an Angular component within the module before proceeding

In my table-basic.component.ts file, I declared 'tables-basic' as a selector and included this template in dashboard.html. Despite following the steps outlined below, I encountered an error which is also highlighted. Snippet from my dashboard.te ...

Having difficulty toggling a <div> element with jQuery

I am attempting to implement a button that toggles the visibility of a div containing replies to comments. My goal is to have the ability to hide and display the replies by clicking the button. The "show all replies" button should only appear if there are ...

Explore the directory to find both files and folders, then display them in a treeview using Angular

Looking for assistance on scanning server files and folders using PHP to create a downloadable treeview with angular. Does anyone have experience with this? ...

What are the steps to create a CSS grid like this?

Any suggestions on how to create a grid template similar to the image shown in this picture? I am looking to achieve this design without rounded borders and without any gaps between the elements. ...

AngularJS Gallery Showcase

Trying to showcase a collection of videos in a modal using angular.js, I decided to implement the solution from . However, I encountered difficulty in integrating my scope variables into the "html5gallery" class. <div class="html5gallery" data-skin="ho ...

Creating a Stylish ExtJS Container with CSS: A Step-By-Step

I've been experimenting with the ExtJS properties cls, bodyCls, and componentCls but unfortunately, I'm not achieving the desired outcome. As an illustration: Ext.create('Ext.form.Panel', { renderTo: document.body, title: &apo ...

problems encountered while trying to increment ng-click function in Angular JS and Ionic

I'm currently working on developing a quiz using Angular JS and Ionic Framework. However, I've encountered an issue: The "Continue" button is not functioning as expected when clicked (using ng-click) to move to the next question. &l ...

An AngularJS $q module that offers promisify functionality, also known as denodeify

I am seeking a way to share code between my Node.js server and AngularJS client by using browserify. My goal is to maintain API callbacks in Node.js while implementing $q promises in AngularJS. For example: // The function being shared // Located in &apo ...

Does AngularJS have a feature similar to jQuery.active?

As I utilize selenium to conduct tests on my application, I am encountering numerous ajax calls that utilize $resource or $http. It would be convenient if there was a method in angular to monitor active ajax requests so that selenium could wait until they ...

Removing div elements containing specific text using jQuery

Hello everyone, I am trying to remove all divs that contain a specific part of a string. Does anyone know how I can do this? This is what my original HTML looks like: <div class="article-options_4"></div> And this is the new HTML structure, ...

Guide on incorporating the WHERE clause into an insert statement in PHP version 5.1.6

What is the correct way to incorporate a where clause into an insert statement in PHP 5.1.6? In my code, I have declared a global variable $module and I am trying to use a where clause to refine my search results. Specifically, I want to include where mod ...

I am encountering an issue with CreateJS where I receive the error message: "createjs is not defined"

Looking for assistance with my createJS issue. var stage = new createjs.Stage(canvas); Encountering the following error : angular.js:13642 ReferenceError: createjs is not defined, even though I have EaselJS in my bower-components. Appreciate any hel ...

What is the process for incorporating Angular.js with a live messaging platform such as Pusher or PubNub?

Can Pusher or PubNub be implemented as an Angular service? Anyone have any examples of code for this kind of integration? ...

AngularJS enables users to showcase and edit images row by row in a table simply by hovering over them

I am currently facing an issue with my code. I initially implemented a mouseover function, but it was quite slow in displaying my edited pictures per row. After some research, I learned that using mouseenter might be faster (which is crucial since I have a ...

Which names can be used for HTML form tags in jQuery?

Recently, I encountered an issue related to jQuery form serialization which stemmed from naming a form tag "elements". The problem arose when using jQuery $(’form’).serialize(). Here is an example of the problematic code: <form> <input name=" ...

Renaming form elements using JQuery's .load method

This is a page named A.html <form name=form> <input type=text id = txtA> </form> When I use jQuery to load it into B.html, it loads multiple times. <form name=form> <input type=text id = txtA> </form> <form name=f ...