Data-bindings inside style=width not working under IE9?

3,077 views
Skip to first unread message

Peter

unread,
Sep 11, 2012, 8:24:45 AM9/11/12
to ang...@googlegroups.com
I am trying to bind the width of a progress-bar to a value and cannot get it to work under Internet Explorer (works fine under Chrome/Firefox), the style-attribute simply disappears...

Example of the behaviour:

http://jsfiddle.net/p4fg/QDv2e/10/

Any advice?

/Peter

Peter Bacon Darwin

unread,
Sep 11, 2012, 8:36:47 AM9/11/12
to ang...@googlegroups.com
This seems to work on my IE9: http://jsfiddle.net/QDv2e/14/
Pete


/Peter

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en.
 
 

peter.af....@factor10.com

unread,
Sep 11, 2012, 8:52:18 AM9/11/12
to ang...@googlegroups.com
Yes, but my data for the progress-bar is inside a list that I am iterating over (ng-repeat="row in items") so i would need to create as many styles as i have items in the list... =(

Still does not explain why it works "everwhere" except IE...

/Peter

Josh

unread,
Sep 19, 2012, 8:47:19 PM9/19/12
to ang...@googlegroups.com, peter.af....@factor10.com
I had exactly the same issue, and here is how i worked around it...

in my view:
 ng-style="itemStyle(item)" - // where 'item' is the repeated item.

n my controller:   
$scope.itemStyle = function (item) {
    return { width: item.percent + '%' };
};

Lee Owen

unread,
Sep 19, 2012, 10:33:01 PM9/19/12
to ang...@googlegroups.com, peter.af....@factor10.com
I had this same issue in IE8 only.  binding inside of the style tag wouldn't work  :(

David Korz

unread,
Jan 15, 2013, 12:09:35 AM1/15/13
to ang...@googlegroups.com, peter.af....@factor10.com, jsco...@gmail.com
Ran into this same issue with angular 1.0.3 and IE9. Had to pollute my directive's scope with nuisance functions of the same sort for ng-style.

Darren Nelsen

unread,
Apr 16, 2013, 1:19:31 PM4/16/13
to ang...@googlegroups.com, peter.af....@factor10.com, jsco...@gmail.com
Thank you, Josh. This helped tremendously.

Павел Пигалёв

unread,
Sep 13, 2013, 9:43:24 AM9/13/13
to ang...@googlegroups.com, peter.af....@factor10.com, jsco...@gmail.com
Thank you very much Josh, you've just saved my ass)
Reply all
Reply to author
Forward
0 new messages