如何通过(点击)事件设置对输入的关注?我有这个功能,但我显然缺少一些东西(角度新手在这里)
sTbState: string = 'invisible';
private element: ElementRef;
toggleSt() {
this.sTbState = (this.sTbState === 'invisible' ? 'visible' : 'invisible');
if (this.sTbState === 'visible') {
(this.element.nativeElement).find('#mobileSearch').focus();
}
}
Run Code Online (Sandbox Code Playgroud) 我正在开发一个 .NET Core 项目,我在其中将 Razor 页面作为电子邮件模板发送。我跟着这个教程:https : //scottsauber.com/2018/07/07/walkthrough-creating-an-html-email-template-with-razor-and-razor-class-libraries-and-rendering-it-from -a-net-standard-class-library/ 我唯一找不到的是如何通过将所需语言作为参数传递来发送本地化电子邮件(示例):
public async Task<string> RenderViewToStringAsync<TModel>(string viewName, TModel model, string lang)
Run Code Online (Sandbox Code Playgroud)
我在网上找到了一些关于POs和resx文件的东西,但一切都需要一个Startup实现。razor pages 不是主项目,主项目只是一个 API,而前端由另一个 Angular 项目处理。
如何在没有启动文件的情况下在 Razor 类库中实现本地化?
这是项目文件
我有一个AutocompleteSupportFragment的PlacesAPI:
<fragment android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/auto_complete"
android:name="com.google.android.libraries.places.widget.AutocompleteSupportFragment"
android:outlineProvider="bounds"
android:elevation="5dp"
app:backgroundTint="@color/colorWhite"
android:imeOptions="actionSearch"/>
Run Code Online (Sandbox Code Playgroud)
我已经初始化并正确设置了所有内容,但我不知道如何在键盘的Search键上设置触发器。我试过了,但关键是完全忽略了代码:
autocompleteSupportFragment.getView().setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View view, int i, KeyEvent keyEvent) {
if ((keyEvent.getAction() == KeyEvent.KEYCODE_SEARCH || keyEvent.getAction() == KeyEvent.KEYCODE_ENTER || i == EditorInfo.IME_ACTION_SEARCH || i == EditorInfo.IME_ACTION_DONE || keyEvent.getAction() == KeyEvent.ACTION_DOWN || keyEvent.getAction() == KeyEvent.KEYCODE_ENTER) && keyEvent.isTracking() && !keyEvent.isCanceled()) {
Toast.makeText(getApplicationContext(), "Could not predict", Toast.LENGTH_SHORT).show();
return true;
}
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
有没有我尝试过的东西?
android ×1
angular ×1
asp.net-core ×1
asp.net-mvc ×1
c# ×1
java ×1
javascript ×1
localization ×1
razor ×1