选中或取消选中我的切换后,我会有一个复选框,该元素将被添加到textarea。
所以如果不加以检查,我希望将其删除,有没有办法做到这一点?
exemple.html
<ion-toggle class="toggle-small" toggle-class="toggle-calm"
(ionChange)="addElement()" > Airplane Mode
</ion-toggle>
exemple.ts
addElement() {
const messageTextarea = (<HTMLInputElement>document.getElementById('msg'));
const selecStart = messageTextarea.selectionStart;
const selectEnd = messageTextarea.selectionEnd;
let newMessage = '' + this.msg;
newMessage = newMessage.substring(selecStart, 0) +
newMessage.substring(selectEnd, newMessage.length)+this.element;}
答案 0 :(得分:1)
注意我声明了一个模板变量ioToggle并使用了checked属性
String query = "{find_by_id (id: 1){eventName}}";
ExecutionResult result = graphQL.execute(query);
你需要像这样更新addElemnt函数
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
try {
boolean success = mMap.setMapStyle(MapStyleOptions.loadRawResourceStyle(getContext(), R.raw.style_json));
if (!success) {
Log.e("MapsActivityRaw", "Style parsing failed.");
}
} catch (Resources.NotFoundException e) {
Log.e("MapsActivityRaw", "Can't find style.", e);
}
final LatLng myLatlng = new LatLng(-33.999564, 18.516763);
mMap.moveCamera(CameraUpdateFactory.newLatLng(myLatlng));
mMap.animateCamera( CameraUpdateFactory.zoomTo( 11.0f ) );
mMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
public void onMapLoaded() {
bar.setVisibility(View.GONE);
drawCircle(myLatlng);
}
});
}
private void drawCircle(LatLng point){
CircleOptions circleOptions = new CircleOptions();
circleOptions.center(point);
circleOptions.radius(500);
circleOptions.strokeColor(Color.BLACK);
circleOptions.fillColor(0x30ff0000);
circleOptions.strokeWidth(2);
mMap.addCircle(circleOptions);
}