Angular 2 - 使用C#后端进行Http搜索

时间:2017-01-16 21:39:35

标签: c# angular

我正在尝试过滤Angular 2表,我想在服务器后端上过滤以限制发送的数据。我似乎无法找到正确的语法。此时控制器不会被调用。

我有以下服务;

exceptions
| where timestamp > ago(7d) and outerType contains "SqlException"
| project 
    ['SqlException'] = outerType,
    timestamp,
    outerMethod
| extend reason = iff(outerMethod has "timeout", "timeout", "other")
| summarize count(['SqlException']) by bin(timestamp, 1d), reason
| render timechart

和以下C#控制器;

    private productTypesUrl = '/api/producttypes';

    searchProductTypes(): Observable<ProductType[]> {
        let searchTerm = 'mysearchvalue';
        return this.http.get(`${this.productTypesUrl}/find/${searchTerm}`)
            .map((res: Response) => {
                console.log(res)
            })
    }

关于我应该改变什么的任何建议?

1 个答案:

答案 0 :(得分:0)

设法找到它......魔鬼在细节中;

  [HttpGet("/find/{searchTerm}", Name = "FindProductTypes")]

应该是;

  [HttpGet("find/{searchTerm}", Name = "FindProductTypes")]