我正在尝试使用 I18n Angular 工具运行带有 dotnet 核心的 Angular 项目模板。(https://docs.microsoft.com/en-us/aspnet/core/spa/angular?tabs=visual-studio)
这是我在创业课上的内容
app.Map("/fr", fr =>
{
fr.UseSpa(spa =>
{
// To learn more about options for serving an Angular SPA from ASP.NET Core,
// see https://go.microsoft.com/fwlink/?linkid=864501
spa.Options.SourcePath = "ClientApp";
spa.UseSpaPrerendering(options =>
{
options.BootModulePath = $"{spa.Options.SourcePath}/dist-server/fr/main.bundle.js";
options.BootModuleBuilder = env.IsDevelopment()
? new AngularCliBuilder(npmScript: "build:ssr2:fr")
: null;
options.ExcludeUrls = new[] { "/sockjs-node" };
});
if (env.IsDevelopment())
{
spa.UseAngularCliServer(npmScript: "serve:fr");
}
});
});
app.Map("/en", en =>
{
en.UseSpa(spa =>
{
// To learn more about …Run Code Online (Sandbox Code Playgroud) internationalization angular-ui-router server-side-rendering angular-universal
我有这个json信息:
data.ContactName
data.ContactEmal
data.Departement
Run Code Online (Sandbox Code Playgroud)
我希望有这样的功能
function GetMyVal(myStringKey)
{
$.Ajax
,...
, ...
,success :function(data)
{
$("#mytarget").val(data.myStringKey);
}
}
Run Code Online (Sandbox Code Playgroud)
打电话就好 GetMyVal("ContactName");
有些正文可以帮助我创建一个通用的GetByID方法,这里的挑战是,我有很多实体,每个实体都有不同的PK名称.
我看到几个带有Generic GetByID的例子,但是其中很多都有像(id)一样的PK Name.
谢谢.
如何创建一个按钮,用 WSEDIT 类覆盖每个 html 元素。
首先,我知道我需要一个 javascript 循环来查找具有 css 类 WSEDIT 的每个元素,并动态创建一个按钮,并在每个具有 WSEDIT 类的元素中添加此按钮。
javascript循环和按钮创建示例
$(function()
$(".WSEDIT").each(function(){
var btnConfigure = $("<div class='BBtnConfigure'>");
$(this).prepend(btnConfigure);
});
);
<div class="WSEDIT" style="width:200px;height:400px;border:1px solid #000000">
<p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
</p>
<div>
<div class="WSEDIT" style="width:200px;height:400px;border:1px solid #000000">
<h2>Sale For First Trimestriel</h2>
<img src="/graph.png" />
<div>
<div class="WSEDIT" style="width:200px;height:400px;border:1px solid #000000">
<table>
<tr><td>Name</td><td>Sex</td></td>Age</td<td>Country</td></tr>
...
</table>
<div>
Run Code Online (Sandbox Code Playgroud)
这是我在下图中尝试执行的操作。

问题是,我的 btn 类按钮 BBtnConfigure 的 CSS 应该是什么
正如您在图片中看到的,BtnConfigure 与每个部分重叠。
我有一个的UserContext服务,我就会把一些基本的功能(” IsAuthenticated,GetUser等...)
为此,我需要将HTTPContextWebAPI控制器中的传递给我的类库服务。
实际上,HttpContext始终null在Web api控制器中。
有人有解决我问题的解决方案吗?有没有更好的方法来实现它。
Web API用户控制器
[Route("api/[controller]")]
[Authorize]
public class UserController : Controller
{
private readonly IUserContextServices _userContextServices;
private readonly User loggedUser;
public UserController()
{
//HttpContext ALWAYS NULL
_userContextServices = new UserContextService(HttpContext);
}
}
Run Code Online (Sandbox Code Playgroud)
UserContext服务
namespace MyProj.Services
{
public interface IUserContextServices
{
UserContext GetUserContext();
bool IsUserAuthenticated();
}
public class UserContextService : IUserContextServices
{
private readonly HttpContext _context;
private UserContext _userContext;
public UserContextService(HttpContext context)
{
_context = context;
InitUserContext();
} …Run Code Online (Sandbox Code Playgroud) 这是我目前的数据
FileNumber | Type | PerYear | PerMonth
L200200 Boat 2013 1
L303000 Boat2 2013 1
L400400 Yack 2013 2
L500500 Comp 2013 2
L600600 Item 2013 3
...
L909000 Chair 2014 1
X900220 Battle 2014 2
Run Code Online (Sandbox Code Playgroud)
我希望有一个基于PerYear和PerMonth的Identity(计数器)列的查询这是我想要的结果
KindOFIdentity FileNumber | Type | PerYear | PerMonth
1 L200200 Boat 2013 1
1 L303000 Boat2 2013 1
2 L400400 Yack 2013 2
2 L500500 Comp 2013 2
3 L600600 Item 2013 3
4 ...
5 ...
6 ...
7 ...
8 …Run Code Online (Sandbox Code Playgroud)