-
-
Notifications
You must be signed in to change notification settings - Fork 241
Failed resolving method setChecked on class android.widget.Switch #943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From @LunicLynx on August 14, 2017 22:52 This is a workaround: export class AppComponent implements OnInit, OnDestroy {
subscription: Subscription;
dataSubject: BehaviorSubject<{ toggle: boolean }> = new BehaviorSubject({ toggle: true });
data = this.dataSubject.asObservable();
ngOnInit(): void {
this.subscription = Observable.of({ toggle: false }).delay(5000).subscribe(
data => {
this.dataSubject.next(data);
}
);
}
ngOnDestroy(): void {
this.subscription.unsubscribe();
this.subscription = null;
}
} But i think it should work either way. |
From @EddyVerbruggen on August 15, 2017 8:43 I'm not sure if it helps for your case, but have you tried this? <StackLayout>
<Switch [(ngModel)]="data?.toggle"></Switch>
</StackLayout> |
related to #846 |
@NickIliev it's not possilbe to use the |
This worked for me, I've made the names more generic, but otherwise this is my code. My XML/HTML
My TypeScript
|
Facing this issue with Text Field: |
I'm hitting this issue with the Switch widget, this was NOT resolved...
|
Wanted to share my workaround until this is resolved, in my case, I had a list of items which next to each I wanted to give a I wrote it like so:
And to answer the above question what was missing for you was also the
|
From @LunicLynx on August 14, 2017 22:49
The Problem
When using an ngIf on a StackLayout including a Switch like so:
Using a two-way binding. One will get the following error:
This seems to be a general problem with ngModel and Switch, whenever the value gets lazily initialized this error seems to happen.
Platforms
Android
Versions
package.json
Repo that reproduces the error
I created a repo reproducing the error. Just start it and wait for 5 Seconds.
https://github.com/LunicLynx/ns-ngif-switch-ngmodel-async-issue
Copied from original issue: NativeScript/NativeScript#4694
The text was updated successfully, but these errors were encountered: