Terhoraj
Terhoraj

Reputation: 285

Nativescript getViewById from ViewModel

I am used to get the TextField using getViewById() to apply native android filters to it. How can I do this from ViewModel without breaking the rules of the MVVM architecture?

Upvotes: 2

Views: 956

Answers (1)

ˈvɔlə
ˈvɔlə

Reputation: 10262

You cannot access the TextField from the ViewModel without breaking the MVVM pattern.

Anyway, I would advice you to just call getViewById() from ViewModel to set native android filter functionality, since the MVVM implementation of NativeScript is not designated solving this problem. You doesn't have to fear that this is bad practice at all.

Upvotes: 2

Related Questions