小编Ita*_*nex的帖子

Angular ui-select:如何仅将选定值绑定到ng-model

$scope.property = new Property();
$scope.property.propertyType = {};

$scope.propertyTypes = [
    { value: 'ResidentialPlot', name: 'Residential Plot' },
    { value: 'CommercialPlot', name: 'Commercial Plot' },
    { value: 'Apartment', name: 'Apartment/Flat' },
    { value: 'Townhouse', name: 'Townhouse' },
    { value: 'House', name: 'Single Family House' },
    { value: 'Commercial', name: 'Commercial Property' }
];

<label for="ptype" class="col-sm-2 control-label">Property Type</label>
<p>Populated: {{property.propertyType}}</p>
<ui-select ng-model="property.propertyType" id="ptype" theme="selectize" ng-disabled="disabled" style="width: 300px;" title="Choose Property Type">
    <ui-select-match placeholder="Select a Property Type">{{$select.selected.value}}</ui-select-match>
    <ui-select-choices repeat="propType in propertyTypes">
        <span ng-bind-html="propType.name"></span> …
Run Code Online (Sandbox Code Playgroud)

angularjs ui-select

11
推荐指数
2
解决办法
2万
查看次数

combineLatest 使用 6 个或更多流抛出 TS2349

这是我第一次涉足 RxJS,所以如果有更好的解决方案,我完全赞成。我的目标是收集相关对象并在代码中加入它们(本质上是一个 sql 左连接)。这源于我使用 Angular In Memory API 对象作为数据库,直到它建立为止。

当我结合 Plans、Specieses、Codebooks、UpstreamModalities 和 TissueProcessions 时,此代码按预期工作。当我包含 Probes、Imaging 和 Analysises 流时,我对读取错误 blob 感到头疼。基本上 array.map 函数中的每一行都会抛出 TS2349 错误,即使是在添加其余三个源之前工作的那些。

import { Component, OnInit } from '@angular/core';
import { Plan } from '../plan';
import { PlanService } from '../plan.service';
import { DatabaseService } from 'src/app/serivces/database.service';
import { combineLatest } from 'rxjs';
import { map, tap } from 'rxjs/operators';

@Component({
  selector: 'app-plans-list',
  templateUrl: './plans-list.component.html',
  styleUrls: ['./plans-list.component.scss']
})
export class PlansListComponent implements OnInit {
  plans$ = combineLatest([
    this.planService.getPlans(), …
Run Code Online (Sandbox Code Playgroud)

rxjs typescript angular

8
推荐指数
1
解决办法
1337
查看次数

ARM 模板 Web 应用程序身份验证设置不起作用

我正在设置我的站点身份验证设置以使用 AAD 提供程序。大多数模板都受到尊重。但是,unauthenticatedClientActionallowedAudiences没有被正确分配。我观察到“允许匿名”并且没有分配“允许的观众”。

请注意,我正在使用 ARM Template API 2018-02-01。由于文档原因,此问题可能仍然存在,如果您提供答案,请注意其解决的 ARM 模板版本。

此外,为 ARM 文档团队创建一个问题以更正任何问题。

这是我的这些设置的模板段。它嵌套在我的网站模板中的资源下。

根 > Microsoft.Web/站点 > 资源

{
    "type": "config",
    "name": "web",
    "apiVersion": "2016-08-01",
    "location": "[parameters('app-location')]",
    "dependsOn": [
        "[resourceId('Microsoft.Web/sites', variables('web-site-name'))]"
    ],
    "properties": {
        "siteAuthEnabled": true,
        "siteAuthSettings": {
            "enabled": true,
            "unauthenticatedClientAction": "RedirectToLoginPage",
            "tokenStoreEnabled": true,
            "defaultProvider": "AzureActiveDirectory",
            "clientId": "[parameters('web-aad-client-id')]",
            "issuer": "[concat('https://sts.windows.net/', parameters('web-aad-tenant'))]",
            "allowedAudiences": [
                "[concat('https://', variables('web-site-name'), '.azurewebsites.net')]"
            ]
        }
    }
}
Run Code Online (Sandbox Code Playgroud)
  • 模板验证
  • 部署不输出任何错误

问题:

  1. unauthenticatedClientAction 被分配允许匿名而不是 RedirectToLoginPage
  2. allowedAudiences 未分配任何站点

什么可能导致这些问题?我可能错过了什么?

azure-active-directory azure-resource-manager azure-web-app-service

6
推荐指数
1
解决办法
2641
查看次数

如何使用'out'参数测试方法?

我正在尝试为具有参数的方法编写单元测试.我的方法特别是我的自定义对象的TryParse方法.我在Visual Studio 2013中使用.NET 4.5/5.这使我可以使用PrivateType对象完全实现私有/内部和静态对象.似乎逃避我的一件事是如何测试out参数,因为我不能在InvokeStatic方法中使用this关键字.我正在寻找适当的解决方案来测试这种架构设计.

TryParse的使用是TypeConverter进程的一部分,如WebAPI参数绑定帖子中所述.作者:Mike Wilson

public class MyFilter
{
    public string Field { get; set; }
    //... removed for brevity

    internal static bool TryParse(string sourceValue, out MyFilter filter)
    {
        //... removed for brevity
    }
}

public class MyFilterTests
{
    [TestMethod]
    [TestCategory("TryParse")]
    public void TryParseWithTitleOnly()
    {
        var stringSource = "{field:'DATE.FIELD'}";

        MyFilter tryParseOut = null;

        var target = new PrivateType(typeof(MyFilter));

        var tryParseReturn = target.InvokeStatic("TryParse", stringSource, tryParseOut);

        var expectedOut = new MyFilter()
        {
            Field = "DATE.FIELD"
        };

        Assert.IsTrue((bool)tryParseReturn);
        Assert.AreEqual(expectedOut, tryParseOut);
    } …
Run Code Online (Sandbox Code Playgroud)

c# unit-testing out

4
推荐指数
1
解决办法
2152
查看次数