小编Wei*_*nix的帖子

如何从angular2-modal返回结果,或者通常从ng2-components返回结果

我正在使用这个伟大的angular2模式,但无法弄清楚如何从我的自定义模态返回结果值.

我像这样实例化它:

    let dialog: Promise<ModalDialogInstance>;
    let bindings = Injector.resolve([
        provide(ICustomModal, { useValue: this.gewaehltesBild })
    ]);
    var self = this;
    dialog = this.modal.open(
        <any>ImagecropperComponent,
        bindings,
        new ModalConfig("md", true, 27));


    dialog.then((resultPromise) => {
        return resultPromise.result.then((result) => {
            this.lastModalResult = result;
            this.mitarbeiter.avatarImg = this.gewaehltesBild;

            $(self.elementRef.nativeElement).find('#bildSelector').val("");
        }, () => this.lastModalResult = 'Rejected!');
    });
Run Code Online (Sandbox Code Playgroud)

我试图发送我的returnvalue

this.dialog.close(this.croppedImage);
Run Code Online (Sandbox Code Playgroud)

但结果总是为空.angular2中是否有一个约定如何从组件返回值,即angular2-modal?

谢谢!

return-value promise angular

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

如何根据linq和c#列中的行之间的差异进行分组?

我想在行中的值之间的差异大于5时创建一个新组.

例:

int[] list = {5,10,15,40,45,50,70,75};
Run Code Online (Sandbox Code Playgroud)

应该给我3组:

1,[ 5,10,15 ]
2,[40,45,50]
3,[70,75]
Run Code Online (Sandbox Code Playgroud)

可以在这里使用Linq吗?

谢谢!

c# linq group-by

5
推荐指数
1
解决办法
172
查看次数

如何将 WebDeploy 与 ASP.Net core 结合使用

我们有一个更新程序,可以自动将 WebDeploy 包发布到 IIS 服务器。该程序适用于 MVC 5 - 应用程序,但不适用于 .Net Core 应用程序。我们使用 Microsoft.Web.Deployment - API,我的发布方法如下所示:

private void UpdateIIS(DTOs.ApplicationConfiguration.ApplicationServer applicationServer, DTOs.Update.Update update) {
    // SSL-Zertifikatsfehler ignorieren
    System.Net.ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(
        (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) => { return true; });
    var sourceBaseOptions = new DeploymentBaseOptions();
    var destBaseOptions = new DeploymentBaseOptions() {
        ComputerName = string.Format("https://{0}:{1}/msdeploy.axd?site={2}", applicationServer.Adresse, applicationServer.MSDeployPort, applicationServer.SiteName),
        UserName = applicationServer.User,
        Password = applicationServer.Passwort,
        AuthenticationType = "Basic"
    };
    string updatePackage = Directory.GetFiles(update.UpdateDirectory, "*.zip").FirstOrDefault();
    if (!File.Exists(updatePackage)) {
        throw new Exception("Update-Paketdatei …
Run Code Online (Sandbox Code Playgroud)

iis msdeploy webdeploy asp.net-core

5
推荐指数
1
解决办法
3598
查看次数

模型未使用Ember.js和WebApiAdapter序列化

我正在尝试将Ember.js MVC4 Spa模板与我自己的模型一起使用,但我没有让它工作.

目前,服务器端代码正在运行.浏览器的结果是正确的.但Ember-Data或自定义WebApi - Serializer无法准备数据.

我有两个模特:病人:

App.Patient = DS.Model.extend();
App.Patient.reopen({
    patientId: DS.attr('number'),
    firstName: DS.attr('string'),
    lastName: DS.attr('string'),
    aufenthalte: DS.hasMany('aufenthalt'), //, { async: true }
    fullName: function () {
        return this.get('firstName') + ' ' + this.get('lastName');
    }.property('firstName', 'lastName'),
});

App.PatientSerializer = DS.WebAPISerializer.extend({
    primaryKey: 'patientId',

    // ember-data-1.0.0-beta2 does not handle embedded data like they once did in 0.13, so we've to update individually if present
    // once embedded is implemented in future release, we'll move this back to …
Run Code Online (Sandbox Code Playgroud)

javascript asp.net-mvc-4 ember.js asp.net-web-api

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