我看了一些答案,但没有工作对我来说,我输了...我用科尔多瓦,离子和角2对象不支持属性或方法“的getAttribute”
这里是我的HTML
<ion-col *ngFor="let value of myButtonsFirstRow" width-25><button #elem ptcolor (click)="volumeClick(elem)" attr.floatValue="{{value}}"> {{value | fraction}}</button></ion-col>
这里是我的打字稿
volumeClick(htmlElem: HTMLElement) {
this.volumeSelected = +htmlElem.getAttribute('floatValue');
}
我想设置从我创建的属性值(在我的HTML)。但看起来像我不能使用getAttribute方法。我的htmlElem已设置,但我没有看到该方法,所以我知道我做错了什么,但我不知道是什么!
由于
这就是我认为的离子元素...即使按钮元素与HTML相同哈哈。无论如何,我不会再为那一个而堕落。你的答案#1是完美的!再次感谢 ! :) – theyouishere