小编sam*_*113的帖子

ng-bind与角度中的一次绑定有什么区别

在角度js中"ng-bind"和"一次性绑定"之间有什么区别.

如果有任何差异,我应该在哪里使用它们?

angularjs

20
推荐指数
3
解决办法
4万
查看次数

带有null参数的$ http.get未访问Web API控制器

我想在角度应用程序中使用$ http.get尝试使用Web API GET控制器,如下所示:

$http.get(BasePath + '/api/documentapi/GetDocuments/' , 
                                {
                                    params: {
                                        PrimaryID: ID1,
                                        AlternateID: ID2,                                            
                                    }
                                }).then( ...
Run Code Online (Sandbox Code Playgroud)

在我的情况下,PrimaryID或AlternateID将具有该值.因此,其中一个将始终为null.

我的Web api方法是

public DocumentsDto[] GetDocuments(decimal? PrimaryID, decimal? AlternateID)
    { ...
Run Code Online (Sandbox Code Playgroud)

当其中一个值为null时,$ http.get生成的url如下所示:

http://BaseServerPath/api/documentapi/GetDocuments/?PrimaryID=1688 
Run Code Online (Sandbox Code Playgroud)

要么

 http://BaseServerPath/api/documentapi/GetDocuments/?AlternateID=154
Run Code Online (Sandbox Code Playgroud)

这没有达到我的Web API方法.

但是,如果我使用

http://BaseServerPath/api/documentapi/GetDocuments/?PrimaryID=1688&AlternateID=null
Run Code Online (Sandbox Code Playgroud)

有用.我可以在我的参数中将值硬编码为null,但是我想知道是否有任何正确的方法来实现这一点.

谢谢,山姆

angularjs angular-http asp.net-web-api2

7
推荐指数
1
解决办法
6217
查看次数

列的JqGrid工具提示

我们如何在列级添加工具提示.我的意思是列级别是所有行(属于同一列)应具有相同的工具提示内容.

例如,考虑一个名为"Manager Name"的列.该列的所有行都应显示工具提示"单击此处查看经理详细信息".

这可以在colModel级别完成.我知道自定义格式化程序,我可以在其中添加标题"cellValue".但我真的不是在寻找这个,因为我已经在使用复杂的自定义格式化程序.

我希望有一种直接的方法来实现这一目标.

jqgrid jqgrid-asp.net jqgrid-formatter

3
推荐指数
1
解决办法
4971
查看次数

ASP.NET MVC中的区域路由

我对区域路由有点困惑.我创建了一个名为Backbone的区域.我有我的默认控制器,视图和模型.

http://localhost:46870/ 
Run Code Online (Sandbox Code Playgroud)

给我以下错误:

Multiple types were found that match the controller named 'home'. This can happen if     
the route that services this request ('{controller}/{action}/{id}') does not specify   
namespaces to search for a controller that matches the request. If this is the case,  
register this route by calling an overload of the 'MapRoute' method that takes a 
'namespaces' parameter.

The request for 'home' has found the following matching controllers:
LearnJavascript.Areas.BackBone.Controllers.HomeController
LearnJavascript.Controllers.HomeController
Run Code Online (Sandbox Code Playgroud)

这是骨干路线(这带有脚手架,我没有做任何改动):

    public override void RegisterArea(AreaRegistrationContext context) 
    {
        context.MapRoute(
            "BackBone_default",
            "BackBone/{controller}/{action}/{id}", …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc asp.net-routing

3
推荐指数
1
解决办法
5306
查看次数

Automapper-如何从源子对象映射到目标

我正在尝试从源的子对象映射到目标(作为父对象)。

源模型:

public class SourceBaseResponse<T> where T : new()
{
    public string Type { get; set; }

    public string Id { get; set; }

    public T Attributes { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

对于我的示例,我正在使用T为SourceAssignment类型

 public class SourceAssignment
{
    public string Id { get; set; }

    public string Email { get; set; }

    public string EmployeeId { get; set; }

    public string FirstName { get; set; }

    public string LastName { get; set; }

    public DateTimeOffset CreatedAt { get; set; }

} …
Run Code Online (Sandbox Code Playgroud)

c# automapper automapper-5

3
推荐指数
1
解决办法
2468
查看次数

我应该使用静态方法(C#)

我应该在以下两种情况下使用静态:

情况1)

public class RequestHeader
{
    private string Username { get; set; }
    private string Password { get; set; }
    private string AccessKey { get; set; }

    public string url { get; set; }
    public string pageid { get; set; }
    public string organizationid { get; set; }

    private RequestHeader()
    {
    }

    public static RequestHeader GetRequestHeader(string url, string pageid, string organizationid)
    {
        return new RequestHeader()
        {
            Username = "Some logic to fetch username",
            Password = "Some logic to fetch password", …
Run Code Online (Sandbox Code Playgroud)

c# static static-methods

2
推荐指数
1
解决办法
283
查看次数