How to get element in nativescript?


Dear sir/madam.

Thanks for your attention.
I have one problem due to developing my app using nativescript.
I used searchbar in one page.

<SearchBar #sb hint=“search” [text]=“SearchPharase” (submit)=“onSubmit(sb.text)” class=“searchbox” style=“horizontal-align:center”>

Next, I tried to remove focus from the searchbar.

@ViewChild(“sb”) SBref: ElementRef;


But I didn’t get my required effective.
Unfortunately, I don’t know about the reason and I decided to get your help here.
Please help me.

Thanks and regards.


could you check your spelling:;

should be, I think,;


thanks for your attention.

I have another problem.
As I mentioned to developing nativescript app using typescript and angluar2.0.
I’m going to compose various template files for multiple screen sizes.
For example…


selector: “my-app”,
templateUrl:“pages/login/login.html” ,
styleUrls:[“pages/login/login-common.css”, “pages/login/login.css”]

is this right?

unfortunately, I don’t have android tablet and I use genymotion and phone.
I want to make different UI between tablet and smartphone.
Please let me know how can I impelement for that and how can I test?


one thing at a time… did the previous solution work? If so, can you mark it as solved and open this new issue on a new thread? That will get you greater visibility. Thanks!



you mean I have to build two another apks?
I want only one apk.
Is it possible?


no, I need you to have one topic on a given Forum thread, this is an administrative detail that will make helping you easier.


I’m guessing the page with the searcher opens the keyboard on launch ? you can do the following to fix that