我有一个小问题.
我正在使用这个HTML代码:
<ion-input id="amount" type="number" ></ion-input>
Run Code Online (Sandbox Code Playgroud)
<button (click)="setinput()">Set Value</button>
而这个TS代码:
setinput(){
var input= document.getElementById("amount") as HTMLInputElement;
input.value=42;
console.log("amount");
console.log(input.value);
}
Run Code Online (Sandbox Code Playgroud)
我的控制台告诉我,数字已经改变了.但更新后的值不会显示在我的输入字段中.你有什么建议吗?
提前致谢!
L. Trembon
我正在使用离子2,并希望在运行时加载图片.在过去的项目中,我总是这样做:
bikeImage.src = "data:image/jpeg;base64," + bikeResult.image;
Run Code Online (Sandbox Code Playgroud)
但它在TypeScript中不起作用.
我的HTML看起来像这样.
<img id='bikeImage'/>
Run Code Online (Sandbox Code Playgroud)
它说,src是一个未解决的变量.
我认为每个JavaScript代码也适用于TypeScript.我错了吗?
有人知道如何解决这个问题吗?
提前致谢.
这是我的HTML代码,但文本包装在某种程度上不适用于此选择组件.有人有想法吗?
<ion-list>
<h5 color="primary">
Choose:
</h5>
<ion-item text-wrap>
<ion-select text-wrap class="selectWidth" okText="Ok" cancelText="Cancel" [selectOptions]="selectOptions" [(ngModel)]="Decision">
<ion-option text-wrap selected="true" color="primary" value="vone" text-wrap>first first first first first</ion-option>
<ion-option text-wrap color="primary" value="vtwo">second second second second second second second</ion-option>
<ion-option text-wrap color="primary" value="vthree">third third third third third</ion-option>
</ion-select>
</ion-item>
</ion-list>Run Code Online (Sandbox Code Playgroud)