I'm wondering how to set tye 'style' of an element using Angular 2. I get
various run-time exceptions when everything I've tried.
In my controller class's onInit() method I set:
this.styleTest = "width: 50%";
I've tried:
1) <table width="350" class="ReportTable" style="{{styleTest}}">
EXCEPTION: TypeError: Cannot set property style of #<Element> which has
only a getter in [{{styleTest}} in null]
2) <table width="350" class="ReportTable" [style]="styleTest">
EXCEPTION: TypeError: Cannot set property style of #<Element> which has
only a getter in [styleTest in null]
3) <table width="350" class="ReportTable" *ng-style="styleTest">
EXCEPTION: Cannot find a differ supporting object 'width: 50%' in
[styleTest in null]
..and various other variations, all resulting in exceptions at run-time.
And yes, I'm including NgStyle in my "import" and @View directives list.
Unrelated question: is there any way to contribute to the preliminary
documentation on angular.io's website?
There is such a shortage of information there right now that I could easily
flesh things out more with the little that I've already learned on these
forums and by various google searches. I'm sure I'm not the only one who
would benefit from an "Angular 1 to 2 transition guide". I could certainly
write a starting version of this.
-Vern
P.S. if Eric Martinez ends up responding to this... then thank you again
for your help. It has been invaluable the past several days. :-)
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.